Ad Widget

Collapse

Zabbix- Powershell alert to monitor the mounted volume

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maestropandy
    Junior Member
    • Mar 2015
    • 2

    #1

    Zabbix- Powershell alert to monitor the mounted volume

    Hi all,

    My Windows machines is having mounted disk named D:, i want to monitor it, if it got fallen, or someone removed by mistake, i need alert alert in zabbix dashboard. Here my question

    To monitor the mounted volume disk ( Say D: drive), i have prepared the powershell script to throw an alert if the disk got unmounted/unavailable. May I know how to map this with zabbix alert ( trigger) to show same alert in zabbix dashboard.? if need to change script mean please suggest.

    Here the script running in machine perfectly.

    $check=Get-WmiObject Win32_LogicalDisk -filter "DeviceID = 'D:' "
    if(!$check)
    {"0"}


    Or can we get we get the same alert with the help of event log management ?

    Thanks in advance
    Last edited by maestropandy; 17-03-2015, 20:34.
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    From top of my head:
    you can add one line to your script to send data to zabbix server, using zabbix_sender.
    check the syntax and examples in Zabbix Documentation


    And don't forget to create Trapper items under Host, which you want to monitor, before starting your script.
    Sincerely yours,
    Aleksey

    Comment

    • maestropandy
      Junior Member
      • Mar 2015
      • 2

      #3
      Addition :

      Thanks added the zabbix sender as below :


      Assume

      hostname : win2k12
      key : trap

      zabbix_sender -c /usr/local/etc/zabbix_agentd.conf -s win2k12 -k trap -i alert.ps1

      The alert.ps1 script as follows, which will throw exit value as "0"


      $check=Get-WmiObject Win32_LogicalDisk -filter "DeviceID = 'D:' "
      if(!$check)
      {"0"}

      ----


      Here my question is how i can automatically run alert.ps1 script which mapped in zabbix_sender or can i run the script directly. Please suggest me ?

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        Two options at least:
        1) UserParameter= in zabbix_agentd.conf

        2) schedule for script starting and Trapper Item.
        Sincerely yours,
        Aleksey

        Comment

        Working...