Active IQ Unified Manager Discussions

OCUM 6.3 custom events functionality?

Mike_Pedigo
4,122 Views

Hi,

 

It does not appear that OCUM 6.3 has the ability to create custom events.  Am I missing the functionality or will that be coming soon?  As an example.  I have a customer that would like to ensure that all volumes/LUNs are thin provisioned and I am trying to use OCUM to identify any volumes/LUNs that are thick provisioned and then would like to execute a script or WFA workflow that would correct the misconfiguration.   Is this a pipe dream?

 

There is a column in OCUM tracking whether a volume or LUN are thin provisioned, but no way to set up an alert currently that I can find.  Will OCUM report down to the LUN level at some point for things like thin provisioning?

 

Thanks,

 

Michael Pedigo

1 ACCEPTED SOLUTION

mbeattie
4,089 Views

Hi Michael,

 

Unfortunately i don't think OCUM enables you to achieve the result your customer wants however if they are using WFA...

 

Assuming your customer wants to ensure that all data volumes on all vservers on all clusters in their environment are always thin provisioned then here is a WFA workflow that can be scheduled on a daily basis to query the WFA database and ensure any thick provisioned volumes have the volume option of "space-guarentee" set from "volume" to "none".

 

Here is the powershell code:

 

param(
   [Parameter(Mandatory=$True, HelpMessage="The name of the volume option to set")]
   [String]$VolumeOptionName,
   [Parameter(Mandatory=$True, HelpMessage="The value of the volume option to set")]
   [String]$VolumeOptionValue,
   [Parameter(Mandatory=$False, HelpMessage="The maximum number of ZAPI re-try attempts")]
   [Int]$ZapiRetryCount
)
#'------------------------------------------------------------------------------
#'Create a query to select all thick provisined volumes on all clusters and vservers.
#'------------------------------------------------------------------------------
[String]$query = "SELECT cluster.primary_address AS 'primary_address', cluster.name AS 'cluster_name', vserver.name AS 'vserver_name', volume.name AS 'volume_name' FROM cm_storage.cluster, cm_storage.vserver, cm_storage.volume WHERE vserver.cluster_id = cluster.id AND volume.vserver_id = vserver.id AND volume.space_guarantee = 'volume' AND volume.junction_path <> '/';"
#'------------------------------------------------------------------------------
#'Invoke the MySQL query to select the clusters.
#'------------------------------------------------------------------------------
$results = Invoke-MySqlQuery -Query $query
Get-WFALogger -Info -Message "Invoked SQL Query`: $query"
#'------------------------------------------------------------------------------
#'Process each cluster.
#'------------------------------------------------------------------------------
[Int]$errorCount = 0
ForEach($result In $results){
   Do{
      [String]$clusterPrimaryAddress = $result.primary_address
      [String]$clusterName           = $result.cluster_name
      [String]$vserverName           = $result.vserver_name
      [String]$volumeName            = $result.volume_name
      If(($clusterPrimaryAddress -ne "") -And ($clusterName -ne "") -And ($vserverName -ne "") -And ($volumeName -ne "")){
         Get-WFALogger -Info -Message "Processing volume ""$volumeName"" on vserver ""$VserverName"" on cluster ""$ClusterName"" primary address ""$clusterPrimaryAddress"""
         #'---------------------------------------------------------------------
         #'Connect to the cluster.
         #'---------------------------------------------------------------------
         Get-WFALogger -Info -Message "connecting to cluster name ""$clusterName"" primary address ""$clusterPrimaryAddress"""
         Connect-WfaCluster $clusterPrimaryAddress
         #'---------------------------------------------------------------------
         #'Create the command to set the volume option.
         #'---------------------------------------------------------------------
         [String]$command = "Set-NcVolOption -Name $VolumeName -Key $VolumeOptionName -Value $VolumeOptionValue -VserverContext $VserverName "
         If($ZapiRetryCount){
            [String]$command += " -ZapiRetryCount $ZapiRetryCount "
         }
         [String]$command += " -ErrorAction Stop"
         #'---------------------------------------------------------------------
         #'Set the volume option.
         #'---------------------------------------------------------------------
         Try{
            Invoke-Expression -Command $command -ErrorAction Stop
            Get-WFALogger -Info -Message "Executed Command`: $command"
            Get-WFALogger -Info -Message "Set volume option ""$VolumeOptionName"" to ""$VolumeOptionValue"" for volume ""$VolumeName"" on vserver ""$VserverName"""
         }Catch{
            Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
            Get-WFALogger -Error -Message $("Failed setting volume option ""$VolumeOptionName"" to ""$VolumeOptionValue"" for volume ""$VolumeName"" on vserver ""$VserverName""")
            [Int]$errorCount = $errorCount + 1
         }
      }
   }Until($True)
}
#'------------------------------------------------------------------------------
#'Ensure an error is raised if there were any failures.
#'------------------------------------------------------------------------------
If($errorCount -ne 0){
   Throw "Failed setting volume option ""$VolumeOptionName"" to ""$VolumeOptionValue"" on all volumes"
}
#'------------------------------------------------------------------------------

It leverages the WFA "Invoke-MySQL" query function to select all thick provisioned data volumes on all clusters on all vservers. EG:

 

#'---------------------------------------

#'Select all thick provisioned volumes on all clusters and vservers

#'---------------------------------------

SELECT

   cluster.primary_address AS 'primary_address',

   cluster.name AS 'cluster_name',

   vserver.name AS 'vserver_name',

   volume.name AS 'volume_name'

FROM

   cm_storage.cluster,

   cm_storage.vserver,

   cm_storage.volume

WHERE

   vserver.cluster_id = cluster.id

AND

   volume.vserver_id = vserver.id

AND

   volume.space_guarantee = 'volume'

AND

   volume.junction_path <> '/';

#'---------------------------------------

 

Here is the example output (note it is connecting to multiple clusters and vservers to set all thick provisioned volumes to thin provisioned volumes)

 

set_global_volume_option

 

You could also use this WFA workflow to set any other volume option globally in your environment...just set the input parameter values. EG

 

input_parameters.jpg

 

hope that helps

 

/matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

2 REPLIES 2

mbeattie
4,090 Views

Hi Michael,

 

Unfortunately i don't think OCUM enables you to achieve the result your customer wants however if they are using WFA...

 

Assuming your customer wants to ensure that all data volumes on all vservers on all clusters in their environment are always thin provisioned then here is a WFA workflow that can be scheduled on a daily basis to query the WFA database and ensure any thick provisioned volumes have the volume option of "space-guarentee" set from "volume" to "none".

 

Here is the powershell code:

 

param(
   [Parameter(Mandatory=$True, HelpMessage="The name of the volume option to set")]
   [String]$VolumeOptionName,
   [Parameter(Mandatory=$True, HelpMessage="The value of the volume option to set")]
   [String]$VolumeOptionValue,
   [Parameter(Mandatory=$False, HelpMessage="The maximum number of ZAPI re-try attempts")]
   [Int]$ZapiRetryCount
)
#'------------------------------------------------------------------------------
#'Create a query to select all thick provisined volumes on all clusters and vservers.
#'------------------------------------------------------------------------------
[String]$query = "SELECT cluster.primary_address AS 'primary_address', cluster.name AS 'cluster_name', vserver.name AS 'vserver_name', volume.name AS 'volume_name' FROM cm_storage.cluster, cm_storage.vserver, cm_storage.volume WHERE vserver.cluster_id = cluster.id AND volume.vserver_id = vserver.id AND volume.space_guarantee = 'volume' AND volume.junction_path <> '/';"
#'------------------------------------------------------------------------------
#'Invoke the MySQL query to select the clusters.
#'------------------------------------------------------------------------------
$results = Invoke-MySqlQuery -Query $query
Get-WFALogger -Info -Message "Invoked SQL Query`: $query"
#'------------------------------------------------------------------------------
#'Process each cluster.
#'------------------------------------------------------------------------------
[Int]$errorCount = 0
ForEach($result In $results){
   Do{
      [String]$clusterPrimaryAddress = $result.primary_address
      [String]$clusterName           = $result.cluster_name
      [String]$vserverName           = $result.vserver_name
      [String]$volumeName            = $result.volume_name
      If(($clusterPrimaryAddress -ne "") -And ($clusterName -ne "") -And ($vserverName -ne "") -And ($volumeName -ne "")){
         Get-WFALogger -Info -Message "Processing volume ""$volumeName"" on vserver ""$VserverName"" on cluster ""$ClusterName"" primary address ""$clusterPrimaryAddress"""
         #'---------------------------------------------------------------------
         #'Connect to the cluster.
         #'---------------------------------------------------------------------
         Get-WFALogger -Info -Message "connecting to cluster name ""$clusterName"" primary address ""$clusterPrimaryAddress"""
         Connect-WfaCluster $clusterPrimaryAddress
         #'---------------------------------------------------------------------
         #'Create the command to set the volume option.
         #'---------------------------------------------------------------------
         [String]$command = "Set-NcVolOption -Name $VolumeName -Key $VolumeOptionName -Value $VolumeOptionValue -VserverContext $VserverName "
         If($ZapiRetryCount){
            [String]$command += " -ZapiRetryCount $ZapiRetryCount "
         }
         [String]$command += " -ErrorAction Stop"
         #'---------------------------------------------------------------------
         #'Set the volume option.
         #'---------------------------------------------------------------------
         Try{
            Invoke-Expression -Command $command -ErrorAction Stop
            Get-WFALogger -Info -Message "Executed Command`: $command"
            Get-WFALogger -Info -Message "Set volume option ""$VolumeOptionName"" to ""$VolumeOptionValue"" for volume ""$VolumeName"" on vserver ""$VserverName"""
         }Catch{
            Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
            Get-WFALogger -Error -Message $("Failed setting volume option ""$VolumeOptionName"" to ""$VolumeOptionValue"" for volume ""$VolumeName"" on vserver ""$VserverName""")
            [Int]$errorCount = $errorCount + 1
         }
      }
   }Until($True)
}
#'------------------------------------------------------------------------------
#'Ensure an error is raised if there were any failures.
#'------------------------------------------------------------------------------
If($errorCount -ne 0){
   Throw "Failed setting volume option ""$VolumeOptionName"" to ""$VolumeOptionValue"" on all volumes"
}
#'------------------------------------------------------------------------------

It leverages the WFA "Invoke-MySQL" query function to select all thick provisioned data volumes on all clusters on all vservers. EG:

 

#'---------------------------------------

#'Select all thick provisioned volumes on all clusters and vservers

#'---------------------------------------

SELECT

   cluster.primary_address AS 'primary_address',

   cluster.name AS 'cluster_name',

   vserver.name AS 'vserver_name',

   volume.name AS 'volume_name'

FROM

   cm_storage.cluster,

   cm_storage.vserver,

   cm_storage.volume

WHERE

   vserver.cluster_id = cluster.id

AND

   volume.vserver_id = vserver.id

AND

   volume.space_guarantee = 'volume'

AND

   volume.junction_path <> '/';

#'---------------------------------------

 

Here is the example output (note it is connecting to multiple clusters and vservers to set all thick provisioned volumes to thin provisioned volumes)

 

set_global_volume_option

 

You could also use this WFA workflow to set any other volume option globally in your environment...just set the input parameter values. EG

 

input_parameters.jpg

 

hope that helps

 

/matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Mike_Pedigo
4,076 Views

Thank you for taking the time to do this!  Much appreciated and hope it might help others also.

Public