Ad Widget

Collapse

Poll different items at the same time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • befortin
    Member
    • Jul 2005
    • 48

    #1

    Poll different items at the same time

    Hi,

    I have some items that I need to pool at the same time (I'd like them to refresh, for example, at each minute and 00 seconds).

    The reason is that I then use those 2 items on a single graph, in order to compare them, as in this graph - as you will see, those 2 items are related, but they are not checked at the same time.

    Is there any way to resolve this??

    Actually, this is an issue since I need to use both last values in order to create a calculated item (a hit ration on a database - green value being the "tries", and red value being "hit"). The problem is that if I poll :
    - Green value at 00:00:01
    - Calculated item (ration between green and red) at 00:00:20
    - Red value at 00:00:50
    well, then, at some point, I end up having my calculated ratio comparing values from 2 different minutes.
    Attached Files
    Last edited by befortin; 03-02-2010, 14:22.
  • alj
    Senior Member
    • Aug 2006
    • 188

    #2
    Originally posted by befortin
    Hi,

    I have some items that I need to pool at the same time (I'd like them to refresh, for example, at each minute and 00 seconds).

    The reason is that I then use those 2 items on a single graph, in order to compare them, as in this graph - as you will see, those 2 items are related, but they are not checked at the same time.

    Is there any way to resolve this??

    Actually, this is an issue since I need to use both last values in order to create a calculated item (a hit ration on a database - green value being the "tries", and red value being "hit"). The problem is that if I pool :
    - Green value at 00:00:01
    - Calculated item (ration between green and red) at 00:00:20
    - Red value at 00:00:50
    well, then, at some point, I end up having my calculated ratio comparing values from 2 different minutes.
    The best way to resolve this is to use zabbix_sender + script.
    Then all your values will arrive in very close time proximity.

    1. You configure items as zabbix-trapper type (instead of zabbix-poller)
    2. You write your script that does something, gets results and sends them via zabbix_sender
    3. Run that script from cron.

    Make sure you have enough zabbix trappers enabled in the server (at least enough to accept connections from all your scripts that run simultaneously).

    Heres an example - script sends 1 then 0 to pager.test item on all zabbix servers (to test if pager is working). I run it at certain time from cron. Note that this script is for old 1.1* zabbix_sender, you need different commandline parameters for new zabbix_sender binary:
    Code:
    #!/bin/sh
    
    sender=/usr/bin/zabbix_sender
    cfg=/etc/zabbix/zabbix_agentd.conf
    # Extract list of all zabbix servers from agent config
    servers=`grep -im1 ^Server= ${cfg} | cut -f2 -d= | sed 's/,/ /g'`
    hostname=`hostname`
    sport=10051
    
    sendvalue() {
    # send value to each zabbix server
        for s in ${servers}
          do
          ${sender} "${s}" "${sport}" "${hostname}" $1 $2
        done
    }
    
    sendvalue pager.test 1
    sleep 1
    sendvalue pager.test 0
    exit 0

    Comment

    • alj
      Senior Member
      • Aug 2006
      • 188

      #3
      note to developers - i wish you'd accept STDIN as file name for metrics file in zabbix_sender so i can write send many values in realtime instead of storing them in some file before calling zabbix_sender which introduces unwanted delay.

      For example most of my scripts have several data gathering threads and one thread that sends results to trapper (one thread so it utilises only one trapper process), right now i call zabbix_sender for every metric which is extremely inefficient.
      INstead of that i would prefer to launch sender un subprocess pipe and just send all metrics to that pipe, where zabbix_sender would grab them and send one by one immediately after newline character.

      Right now zabbix_sender does not accept STDIN or "-" in -f command line, i wish it could.

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Originally posted by alj
        note to developers - i wish you'd accept STDIN as file name for metrics file in zabbix_sender so i can write send many values in realtime instead of storing them in some file before calling zabbix_sender which introduces unwanted delay.
        Please register a new feature request.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • zabbix_zen
          Senior Member
          • Jul 2009
          • 426

          #5
          alj,

          When creating the request please reply to this thread with it's ticket number.
          I'm also interested watching this development.

          Comment

          • befortin
            Member
            • Jul 2005
            • 48

            #6
            @ alj : Thanks. However, I'm using Zabbix to monitor an environment using SNMP only. Using the agents is not an option here - since this is a highly critical environment, if we were using the agent, we would need to run some *very* time-consuming capacity-performance tests on each upgrade of Zabbix agents, and we would need to upgrade the agents during the night, and have some tests ran at night by the QA department...


            @ Zabbix devs : I think that it would be nice to be able to define some "linked" items to make sure that Zabbix server polls them at the same time. This would allow for both nice graphs, and calculated items that compare different values to get a ratio. Do you think that this would be possible in the next release?

            Comment

            • zabbix_zen
              Senior Member
              • Jul 2009
              • 426

              #7
              If you are absolutely limited to SNMP checks it's one thing, but alj sugestion,
              /usr/bin/zabbix_sender, doesn't need an agent running on the machine.

              It's an independent binary you can use to send individual values to a given key of a chosen Zabbix Server destination.

              Comment

              • befortin
                Member
                • Jul 2005
                • 48

                #8
                @ zabbix_zen : Oh, I see... Then I'll run the snmpget + zabbix_sender on the Zabbix server itself - Thanks!

                Comment

                • richlv
                  Senior Member
                  Zabbix Certified Trainer
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Oct 2005
                  • 3112

                  #9
                  Originally posted by alj
                  note to developers - i wish you'd accept STDIN as file name for metrics file in zabbix_sender so i can write send many values in realtime instead of storing them in some file before calling zabbix_sender which introduces unwanted delay.
                  for the record, this was implemented as https://support.zabbix.com/browse/ZBX-1000
                  Zabbix 3.0 Network Monitoring book

                  Comment

                  • hryamzik
                    Junior Member
                    • Dec 2011
                    • 16

                    #10
                    I know this thread is a bit old, the problem is still in place though and there's even a ticket.

                    I didn't want to deal with cron. So I'm getting 3 values from mysql, report one of them with a user defined parameter and in the same script push others with zabbix_sender:

                    Code:
                    UserParameter=my.stats.v1,mysql -u user -psuperpassword -NB somedatabse -e 'select sum(value1), sum(value2), sum(value3) from table;'| while read v1 v2 v3; do zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k my.stats.v2 -o $v2 2>&1 | logger -t zabbix_sender; zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k my.stats.v3 -o $v3 2>&1 | logger -t zabbix_sender; echo $v1; done

                    Comment

                    • Pemol
                      Junior Member
                      • Mar 2014
                      • 4

                      #11
                      I will join to the thread. I have similar problem which was reported by befortin.
                      I have master server and two hosts. I use same user parameters item on both hosts. I have same settings of delay for both items. Is it possible to run items on both hosts at the same time?
                      Last edited by Pemol; 24-03-2014, 23:27.

                      Comment

                      Working...