Ad Widget

Collapse

Zabbix, Windows mount points and Powershell

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anth0ny
    Member
    • Nov 2009
    • 85

    #1

    Zabbix, Windows mount points and Powershell

    I make a solution for Windows mount points monitoring.

    Task

    Monitor a free spase (in bytes and %) for any windows mount point
    at Win2008 R2 (MS Cluster).

    Solution

    Get your mounted points Caption (get it from WMI by query "select * from Win32_Volume"):

    We will use for example the mountpoint T:\Users\Profiles

    At Windows Server side
    * Create subdirectory in zabbix agent directory, call it Scripts (C:\Progra~1\Zabbix)
    * Create a powershell script disk_data.ps1, plase here (C:\Progra~1\Zabbix\Scripts\disk_data.ps1)

    (Note: i use Progra~1 as short format of Program Files directory)

    Script code:

    Code:
    param ($caption, $info)
    gwmi win32_volume|where-object {$_.name -match “$caption”}| % { '{0,10}' -f $_.$info}
    * Allow execution for ps1 unsigned scripts at powershell console

    At Zabbix side

    * Create an Item

    Description: MountPoint T:\Users\Profiles - size
    Type: Zabbix Agent
    Key:
    Code:
    system.run["powershell.exe -NoProfile -NoLogo -File C:\Progra~1\Zabbix\Scripts\disk_data.ps1 T:\\Users\\Profiles Capacity"]
    Type of information: Numeric (unsigned)
    Data type: Decimal
    Units: B
    Store\Show value: As is

    * Create an Item

    Description: MountPoint T:\Users\Profiles - free (in bytes)
    Type: Zabbix Agent
    Key:
    Code:
    system.run["powershell.exe -NoProfile -NoLogo -File C:\Progra~1\Zabbix\Scripts\disk_data.ps1 T:\\Users\\Profiles Freespace"]
    Type of information: Numeric (unsigned)
    Data type: Decimal
    Units: B
    Store\Show value: As is

    * Create an Item

    Description: MountPoint T:\Users\Profiles - free (in %)
    Type: Calculated
    Key:
    Code:
    100*last(system.run["powershell.exe -NoProfile -NoLogo -File C:\Progra~1\Zabbix\Scripts\disk_data.ps1 T:\\Users\\Profiles Freespace"])/last(system.run["powershell.exe -NoProfile -NoLogo -File C:\Progra~1\Zabbix\Scripts\disk_data.ps1 T:\\Users\\Profiles Capacity"])
    Type of information: Numeric (unsigned)
    Data type: Decimal
    Units: %
    Store\Show value: As is

    I think, you can create triggers by yourself.
    Thats all, folks =)
  • Daave
    Junior Member
    • Feb 2014
    • 1

    #2
    Hi Anth0ny, hope you still visit this site. I was wondering if you can tell me how to set this up using v2.2 where the formula is now part of the calculated item type.

    So basically, how the last item would be setup in v2.2.

    If you or anyone for that matter can help me out, I'd really appreciate it. I need to monitor % disk space free on Windows mount points.

    Thanks!

    Comment

    • zyamada
      Junior Member
      • Feb 2014
      • 1

      #3
      Originally posted by Daave
      Hi Anth0ny, hope you still visit this site. I was wondering if you can tell me how to set this up using v2.2 where the formula is now part of the calculated item type.

      So basically, how the last item would be setup in v2.2.

      If you or anyone for that matter can help me out, I'd really appreciate it. I need to monitor % disk space free on Windows mount points.

      Thanks!
      If you change the key to any valid key value (for example "0" will suffice) then put what Anth0ny listed as "key" in the formula field, you should be returned the value you're looking for. This is how I have it setup in my Zabbix instance/

      Comment

      Working...