Ad Widget

Collapse

Using LLD to monitor Windows Services

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • qix
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2006
    • 423

    #16
    As for creating alerts, please read up on triggers, actions and media in the Zabbix manual or various tutorials.
    With kind regards,

    Raymond

    Comment

    • BLinz
      Junior Member
      • Nov 2013
      • 2

      #17
      If you have the "value should be a JSON object" error:

      The Answer of the servdisc-Script ist to Long!

      Change in the Scripts

      PowerShell:
      Search for
      $objItem.Description
      Change to
      ” – ”

      VBS:
      Search for
      objService.Description
      Replace with
      ” – ”

      and so will will not use the Service Desctription.

      I have 117 Running Services, the JSON Message have 16500 Chars - and Zabbix 2.2 with MySQL can take it.

      I also write a .exe Version in AutoIt, Download und Source-Code at

      Site is in german but the description in the Zip is in englisch

      Bernhard Linz

      Comment

      • janosch
        Junior Member
        • Nov 2013
        • 5

        #18
        Thanks BLinz, your solution is the only one working so far when you want to automatically add windows services. Either I am too stupid for the other ones or they are outdated yet.

        I got a question regarding triggers. Will the be created automatically or do I have to create them manually?

        Comment

        • BLinz
          Junior Member
          • Nov 2013
          • 2

          #19
          Originally posted by janosch
          I got a question regarding triggers. Will the be created automatically or do I have to create them manually?
          The triggers will create also automatic. If a Windows Service is deinstalled, Zabbix will delete the Trigger and after 30 days also the item.

          Thats not my trick, thats "build in" Zabbix!

          I only wrote the .exe (after i find the error), the template is the original

          BLinz

          Comment

          • janosch
            Junior Member
            • Nov 2013
            • 5

            #20
            Yeah, I was not patient enough to wait for triggers to be created. Everything works fine so far! Great effort from you and thanks a lot.

            Comment

            • coreychristian
              Senior Member
              Zabbix Certified Specialist
              • Jun 2012
              • 159

              #21
              Just wanted to do a quick post, the script I was using for service discoveries (powershell) broke when I tried to run it with a 2.2.1 version of zabbix server.

              The problem was the last line in the JSON contained an extra comma.

              I fixed the script via the following, just figured I would post it here in case you want to update your github script, or anyone else runs into the issue. There might be a cleaner way to do this, though I have verified this works.

              Old


              Code:
              foreach ($objItem in $colItems) {
               $line =  " { `"{#SERVICESTATE}`":`"" + $objItem.State + "`" , `"{#SERVICEDISPLAY}`":`"" + $objItem.DisplayName + "`" , `"{#SERVICENAME}`":`"" + $objItem.Name + "`" , `"{#SERVICEDESC}`":`"" + $objItem.Description + "`" },"
                write-host $line
              }
              New

              Code:
              $i = 0
              foreach ($objItem in $colItems) {
               $i = $i+1
               $line =  " { `"{#SERVICESTATE}`":`"" + $objItem.State + "`" , `"{#SERVICEDISPLAY}`":`"" + $objItem.DisplayName + "`" , `"{#SERVICENAME}`":`"" + $objItem.Name + "`" , `"{#SERVICEDESC}`":`"" + $objItem.Description + "`" },"
               if ( $i -eq $colItems.length)
               {
               $line =  " { `"{#SERVICESTATE}`":`"" + $objItem.State + "`" , `"{#SERVICEDISPLAY}`":`"" + $objItem.DisplayName + "`" , `"{#SERVICENAME}`":`"" + $objItem.Name + "`" , `"{#SERVICEDESC}`":`"" + $objItem.Description + "`" }"
               }
               
               write-host $line
              }

              Comment

              • emmanux
                Member
                Zabbix Certified Specialist
                • Mar 2013
                • 47

                #22
                May be this method can give you some ideas, it's a simpler method (no powershell or UserParameters at all), and might be improved for greater complexity:

                Comment

                Working...