Ad Widget

Collapse

Monitoring custom values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scottca
    Junior Member
    • Apr 2013
    • 5

    #1

    Monitoring custom values

    Hi All,

    Wonder if you can help. I have a Discovery rule and script that will check the free disk space of a Microsoft cluster shared volume and return the value.

    Can anyone tell me how I can make a discovery monitoring item based on this value, I cant find a key that matches up what I want to it, I just want Zabbix to capture the value of the variable and then I will create a trigger on whether that number is below a certain threshold.

    Thanks in advance,

    Craig
  • scottca
    Junior Member
    • Apr 2013
    • 5

    #2
    Hi All,

    Is anyone able to help me on this one?

    Thanks in advance.

    Craig

    Comment

    • heaje
      Senior Member
      Zabbix Certified Specialist
      • Sep 2009
      • 325

      #3
      Are you saying that your script just returns the value for an item or is it returning json formatted data? Can you post an example of the output? To me it sounds like you're trying to use discovery as a specific item that receives a value. Discovery rules aren't intended for that.

      Comment

      • scottca
        Junior Member
        • Apr 2013
        • 5

        #4
        Thanks for your reply.

        Maybe im using the discovery scripts wrong - I thought it may make this task a bit simpler..

        I have multiple hyper v servers as part of a bigger microsoft cluster, I wanted a script to run on each hyper v box which then returns the value of disk space left on the cluster shared volumes (as the normal disk space monitoring cannot see cluster shared volumes)

        I wanted the same script to run on each server, I know that means when one is low we will receive multiple alerts, but I wanted to safeguard myself as if I just had 1 machine checking, if that check failed for any reason I may not realise..

        my powershell script is below:

        Code:
        # ChangeLog
        # 
        
        
        # Powershell script to retrieve Cluster Shared Volumes and report back available space in a JSON
        # formatted message that Zabbix will understand for Low Level Discovery purposes.
        #
        
        # Set value of server to check - use "hostname" to check self
        $HostName=hostname
        
        # Fetch each CSV from self and store in a varable.
        
        #Quorum
        $CSVVolumeQuorum = Get-WmiObject -Impersonation Impersonate -Authentication PacketPrivacy -ComputerName "$hostname" -Namespace "root\MSCluster" -class "MSCluster_DiskPartition" | where {$_.VolumeLabel -eq "Quorum"} | select -first 1 |
        
        #SAS Raid10 Array
        $CSVVolumeSAS1RAID10 = Get-WmiObject -Impersonation Impersonate -Authentication PacketPrivacy -ComputerName "$hostname" -Namespace "root\MSCluster" -class "MSCluster_DiskPartition" | where {$_.SerialNumber -eq "3200931203"} | select -first 1 |
        
        #SATA1 RAID5 Array
        $CSVVolumeSATA1RAID5 = Get-WmiObject -Impersonation Impersonate -Authentication PacketPrivacy -ComputerName "$hostname" -Namespace "root\MSCluster" -class "MSCluster_DiskPartition" | where {$_.SerialNumber -eq "740910088"} | select -first 1 |
        
        #Quorum
        $CSVVolumeSATA1MIRROR = Get-WmiObject -Impersonation Impersonate -Authentication PacketPrivacy -ComputerName "$hostname" -Namespace "root\MSCluster" -class "MSCluster_DiskPartition" | where {$_.SerialNumber -eq "3327561715"} | select -first 1 |
        
        
        
        # Output the JSON header
        write-host "{"
        write-host " `"data`":["
        write-host
        
        # For each item found, print the output of the JSON message with the object properties we want
        foreach ($objItem in $CSVVolumeQuorum) {
         $line =  " { `"{#CSVVolumeQuorum_TotalSize}`":`"" + $objItem.TotalSize + "`" , `"{#CSVVolumeQuorum_FreeSpace}`":`"" + $objItem.FreeSPace + "`" },"
         write-host $line
        }
        
        foreach ($objItem in $CSVVolumeSAS1RAID10) {
         $line =  " { `"{#CSVVolumeSAS1RAID10_TotalSize}`":`"" + $objItem.TotalSize + "`" , `"{#CSVVolumeSAS1RAID10_FreeSpace}`":`"" + $objItem.FreeSPace + "`" },"
         write-host $line
        }
        
        foreach ($objItem in $CSVVolumeSATA1RAID5) {
         $line =  " { `"{#CSVVolumeSATA1RAID5_TotalSize}`":`"" + $objItem.TotalSize + "`" , `"{#CSVVolumeSATA1RAID5_FreeSpace}`":`"" + $objItem.FreeSPace + "`" },"
         write-host $line
        }
        
        foreach ($objItem in $CSVVolumeSATA1MIRROR) {
         $line =  " { `"{#CSVVolumeSATA1MIRROR_TotalSize}`":`"" + $objItem.TotalSize + "`" , `"{#CSVVolumeSATA1MIRROR_FreeSpace}`":`"" + $objItem.FreeSPace + "`" },"
         write-host $line
        }
        
        # Close the JSON message
        write-host
        write-host " ]"
        write-host "}"
        write-host

        The script runs, looks at itself for the target and then stores some information on several cluster shared volumes (I specifiy which CSV to look at based on the serial numbers of the CSV). It then stores them as several variables and passes back the data in a JSON formatted way.

        I set this up as a discovery rule as I thought it would run every x to collect the data, I could then make an item to check the number returned for variable x and then create an alert when that number goes below a certain value..

        am I doing this all wrong?

        Thanks in advance,

        Craig

        Comment

        Working...