Ad Widget

Collapse

I'm trying to create a custom counter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Avogadro
    Junior Member
    • Dec 2017
    • 2

    #1

    I'm trying to create a custom counter

    Hello,

    I'm a beginner on Zabbix, I've already configured my network monitoring, and I'am trying to monitor my asterisk telephony service now.

    So I end up with some values with items for each of my telephony users with a "0" numeric value when they're offline and a "1" value when they're incall and I would like to create a counter with zabbix which would count the number of times when the value goes from 0 to 1 during 7 days for example in order to have the number of calls on a week for one user.

    Is that even possible? I have read the documentation on triggers and functions and search in the forum but I can't find a similar case to what I would like to do, and I'm a beginner in programming so not sure how to do it.

    The icing on the cake would then be to calculate the duration of calls by counting the time during the value remains at 1 on my items.

    If someone will help me, I thank him in advance.
  • Semiadmin
    Senior Member
    • Oct 2014
    • 1625

    #2
    Hi,Avogadro.
    You may create several calculated items for this.
    Item "call":
    last("your_item.key")=1 and prev("your_item.key")=0
    Item "calls.number":
    count("call",7d,1)
    Item "calls.duration":
    sum("your_item.key",7d)*your_item_update_interval

    Comment

    • Avogadro
      Junior Member
      • Dec 2017
      • 2

      #3
      Great, it's working, thank you so much Semiadmin.
      With that, I can even monitor Asterisk Telephony with grafana plugin for Zabbix.
      I've been trying to find this solution for 3 days.

      For those who are trying to do the same thing, the first step is to get numerical data and not strings from Asterisk (wich is default in asterisk and that doesn't allow you to make graphs) with UserParameter functionality from Zabbix and the trick I found is to ask for a numerical value in the shell, like the number of lines (wc -l) like this:

      asterisk -rx 'core show channels verbose' |grep <sip user> | wc -l

      And you will get a real 0 numeric value when the user is offline and real 1 value when online because when a sip user is online the line appears.

      Comment

      Working...