Ad Widget

Collapse

Calculated item formula syntax.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thysk
    Junior Member
    • May 2013
    • 21

    #1

    Calculated item formula syntax.

    Hi all

    I’m having some issues getting my formulas syntax correct and I was hoping someone could help me out. I pull my servers entire mail log in to Zabbix as an item want search for several different strings and count the occurrence of each( and graph it naturally ) . I would like to avoid pulling each item like this log[/var/log/mail.log,string] as I would prefer for the Zabbix server to do the work.

    I have setup a log item like this log[/var/log/mail.log]

    And attempted to setup a calculated item like this
    count("template_a:log[\"/var/log/mail.log \"].str(\"\")"string,60)

    and this
    count("template_a:log[/var/log/mail.log].str(string)",60)

    but the item gives an error, “ Cannot evaluate function [count(60)]: item [template:log[/var/log/mail.log].str(string)] not found

    Can anybody point out my mistake/s or give me a better way to do this.

    Thanks in advance
    Thys
  • thysk
    Junior Member
    • May 2013
    • 21

    #2
    I could not get it to work the way I wanted so I have made a compromise and created a UserParameter that calls a script that pulls the numbers I want , for the log entries I wanted to include in my alert messages I collect via a log item log[/var/log/mail.log,string 1|string 2|string 3]

    If you have a better way for me please feel free to comment.

    Comment

    • steveboyson
      Senior Member
      • Jul 2013
      • 582

      #3
      That sounds like a pragmatic way.
      I'm in a similar situation like you (https://www.zabbix.com/forum/showthread.php?t=42503)

      Unfortunately since I'm needing more than one "check", the solution you presented has some disadvantages for me.
      - it creates extra items (even if history and trends are set to 0)
      - I need to configure each and every desired item check for a second time

      I wish Zabbix would supply "not stored" items or (even better) the possibility to let an external script do the trigger arithmetics.

      Comment

      • foboss
        Junior Member
        • Nov 2013
        • 7

        #4
        It's very simple!

        Item (Looking for " 50" pattern):
        Code:
        logrt["C:\inetpub\logs\LogFiles\W3SVC1\u_ex*"," 50",ANSI,100]
        Calculated item for " 500 " pattern:
        Code:
        count("logrt[\"C:\inetpub\logs\LogFiles\W3SVC1\u_ex*\",\" 50\",ANSI,100]",60," 500 ","like")
        Calculated item for " 502 " pattern:
        Code:
        count("logrt[\"C:\inetpub\logs\LogFiles\W3SVC1\u_ex*\",\" 50\",ANSI,100]",60," 502 ","like")
        Now we can make some graphs and triggers.

        Comment

        • uzair.tariq@wsn
          Junior Member
          • Jul 2020
          • 2

          #5
          i have some problem still not solved please help me

          Comment

          Working...