Ad Widget

Collapse

Adding to the Items, if else case.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anjiytwok
    Member
    • Dec 2012
    • 44

    #1

    Adding to the Items, if else case.

    Hello,

    I have one case like this.

    Where I will be getting the data, based on that data I need to add it.

    let suppose, My Item name is : totalItem.

    I'd like to do some thing like this.

    if(totalItem >0){
    totalItem+1
    }
    else {
    totalItem
    }
    then after configuring the Item, I should see in the overview/latestdata section totalItem

    please guid me how can I manpulate the data.

    I could see only we can manpulate the data by multiply by some thing.
  • Heilig
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2013
    • 366

    #2
    As one of variants, you can write a script that contains this logic, calculate the data and give the result in zabbix (using external checks, user parameters or zabbix_sender).
    Last edited by Heilig; 16-04-2013, 21:42.

    Comment

    • anjiytwok
      Member
      • Dec 2012
      • 44

      #3
      Hi,

      I have written the external check using .sh file, able to get the what ever I required.

      But I am unable to pass the key to the external script.

      Here the Item which I have created.

      Type : ExternalCheck

      key: JobYieldCal.sh["totalJobs","failedjobs"]

      totalJobs- This is the one of the Calculated Key.
      failedjobs- one more calculated key.

      But I am unable to pass the value, it is taking the totaljobs string instead of the value.

      please guid me how can i pass the value of the calculated key at external check.

      script[<parameter1>,<parameter2>,...]

      I'd like to pass dynamic parameters to the script that is calculated Key's.

      please guid me. thank you.

      Comment

      • Heilig
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Mar 2013
        • 366

        #4
        You can't pass the value of the calculated key to the script like a parameter.

        Macro "totalJobs"/"failedjobs" not supported for item with type External check. You can check supported macro here (look at column 5 "Item key's parameters").

        In this situation you can improve your script and take value "totalJobs" and "failedjobs" from Zabbix by API (history.get). AFTER all calculation, script can put the result into Zabbix (using external checks without parameters or zabbix_sender utility).

        Quite simply, Zabbix calculate items "totalJobs", "failedjobs" and store/show item "GrandTotal" calculated by script.

        Comment

        Working...