Ad Widget

Collapse

Macro Request

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CarlDafs
    Junior Member
    • Aug 2020
    • 9

    #1

    Macro Request

    Hello!
    Thank you for such a great product!
    I would like to request two macros, one that returns a numeric value for NumberofUpDevices (devices that answer PING) and one that returns a numeric value for NumberofDownDevices (devices that do not answer PING). Ideally I would use these macros to send periodic status reports during off-business hours.
  • isaqueprofeta
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Aug 2020
    • 154

    #2
    Using an Aggregated Item you can count/sum your ICMP Items, since it returns 1 for Up and 0 for Down https://www.zabbix.com/documentation...ypes/aggregate from there, you work on ideas comparing it and creating triggers to send via actions your periodic status reports.

    Comment

    • CarlDafs
      Junior Member
      • Aug 2020
      • 9

      #3
      Originally posted by isaqueprofeta
      Using an Aggregated Item you can count/sum your ICMP Items, since it returns 1 for Up and 0 for Down https://www.zabbix.com/documentation...ypes/aggregate from there, you work on ideas comparing it and creating triggers to send via actions your periodic status reports.
      So if I understood this correctly, I created a template called DeviceCount (because I want to be able to apply this to many hosts in a particular host group). Within the DeviceCount template, I created an item called PingItem which is a simple check and uses the key "icmpping[<target>,<packets>,<interval>,<size>,<timeout>]". I left the default of numeric (unsigned) for the type of information. I set the update interval to 30m. I defined a custom interval of 30m, flexible, with a period of 1-4, 07:30-17:30 (because I want this to occur every half an hour during business hours while I am testing it). I'm not interested in keeping history or trend storage.

      Next I have to create a trigger within the DeviceCount template, lets call that StatusReport. I'm leaving the severity as not classified for now. In the expression, this is where I would count the number of hosts that answered PING? So for the expression I am using "grpsum["TargetHostGroup","icmpping"[/,total]",last]".

      And finally, I setup the action which is to email me the result of the StatusReport trigger based on a schedule of my choosing. Am I logically correct in all of this? I appreciate your input and thank you isaqueprofeta!

      PS: I already have a different action configured to alert me (via email) when a host doesn't answer ping, that is working correctly.

      Comment

      • isaqueprofeta
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Aug 2020
        • 154

        #4
        Easier than that, you don't need to create the PingItem that you said, you already have this in your hosts, as you said in PS.

        Just, create a Dummy host with the name of the group that you wanna count. And create the grpsum["TargetHostGroup","icmpping"[/,total]",last] in this group. If you want to create a Dummy host outside in a group called Statistics with all the grpsum from other groups, you're fine too,

        About the trigger is all up to you, you can use internal key item for server/proxy: zabbix[hosts] vs the grpsum and then if theres difference you send the messagem with both values, total hosts and downed hosts, something like that.

        Comment

        • CarlDafs
          Junior Member
          • Aug 2020
          • 9

          #5
          Okay, I think I understand. Based on your advice, I deleted the DeviceCount template and the PingItem item that was created within the template. I recreated the item (this time I called it ItemStatus) within the dummy host (I renamed it to match the host group that I am applying this to - lets just call it TargetHostGroup).

          The ItemStatus item is a Zabbix aggregate, the key is grpsum["TargetHostGroup","icmpping[/,total]",last] (I had to remove the quotation mark in between "icmpping and [/total]" to correct a syntax error). The type of information is Numeric (unsigned). I configured my update interval, as well as a custom (flexible) interval. Not keeping any historical or trend data.

          This item exists within the dummy host. Next I create the trigger, my goal is to have that trigger pulled every half an hour during business hours. But this schedule is important for the action, not the trigger itself.
          *edited for clarity*
          For the trigger itself, I want that to count the number of hosts in the hostgroup and compare that to the number of hosts that answered ping. From there I can identify how many hosts are up versus how many are down.

          Does it sound like I am on the correct path?

          Isaqueprofeta, I thank you very much!
          Last edited by CarlDafs; 25-08-2020, 20:55.

          Comment

        Working...