Ad Widget

Collapse

Multiple variables in one run.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alj
    Senior Member
    • Aug 2006
    • 188

    #1

    Multiple variables in one run.

    I have a script which is very expensive to run (lots of CPU cycles) and i need to extract about 60 monitoring variables from it in real time. Dumping that into text file and grep-ing it is not an option because data is a real time absolute counter which changes every second and zabbix suppose to display data per second graph. Cronjob dump of the parameters to the text file makes graph to be inacurate because cronjob does not run at the same time as zabbix agent gathering data.

    Is there any way to combine those 60 variables somehow so zabbix-agent would run the script only once to extract all of them?

    For example script dumps all variables as comma separated list and agent transfers all of them to the server in one batch:

    variable.name=NN, variable.name2=NN,variable.name3=NN et cetera.
  • Int
    Junior Member
    • Oct 2005
    • 7

    #2
    I vote for this feature too

    Comment

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

      #3
      ZABBIX sender alrady supports this functionality:

      cat file|./zabbix_sender

      The file must have the following format:

      zabbix_server server port key value
      zabbix_server server port key value
      zabbix_server server port key value
      ...

      For example:

      zabbix.zabbix.com www.zabbix.com 10051 mysql.queries 12323454
      zabbix.zabbix.com www.zabbix.com 10051 mysql.users 345


      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter

      Comment

      • ad@kbc-clearing.com
        Member
        • Sep 2005
        • 77

        #4
        Very interesting feature.
        In which version is it included ?

        Comment

        • Int
          Junior Member
          • Oct 2005
          • 7

          #5
          Originally posted by Alexei
          ZABBIX sender alrady supports this functionality:

          cat file|./zabbix_sender
          Ok, how can i synchronize this with zabbix_agent?
          something like:
          UserParameter=foo.fake_status,foo_fake_statis.sh
          foo_fake_statis.sh
          ================
          big_expensive_script.sh > tmp.out
          cat tmp.out |./zabbix_sender
          echo '0'
          ================
          ?

          Comment

          • alj
            Senior Member
            • Aug 2006
            • 188

            #6
            No agent needed for this.
            Your sender sends stuff directly to zabbix server where you should configure "trapper" type of monitor.

            Thats what i end up using.

            Comment

            • RandySpinaGE
              Member
              • Jun 2006
              • 57

              #7
              But I dont want to use cron

              Im with "Int"....
              I try to avoid using an "outside of Zabbix" scheduler. (like cron)

              I suppose your UserParameter example is a good one and an "echo 0 or 1" before exit can act as a status that the LIST of parameters update is "working".

              But I would rather be able to create a UserParameter script directly that is of type "list". (I made that up) that Zabbix schedules for the polling of the listed return.


              Thank you

              version 1.1.3

              Comment

              • alj
                Senior Member
                • Aug 2006
                • 188

                #8
                Originally posted by RandySpinaGE
                Im with "Int"....
                I try to avoid using an "outside of Zabbix" scheduler. (like cron)

                I suppose your UserParameter example is a good one and an "echo 0 or 1" before exit can act as a status that the LIST of parameters update is "working".

                But I would rather be able to create a UserParameter script directly that is of type "list". (I made that up) that Zabbix schedules for the polling of the listed return.


                Thank you

                version 1.1.3
                Whats te point? You asking to reimplement the whole functionality of cron daemon. Then there will be 2 schedulers in a system and 2x time required to support and maintain both of them. That is not UNIX-like.

                I vote so it stays as it is with one exception:
                zabbix-sender should read zabbix server list from zabbix_agentd.conf.

                Right now i'm doing this myself via:
                Code:
                sender=/usr/bin/zabbix_sender
                hostname=`hostname`
                sport=10051
                cfg=/etc/zabbix/zabbix_agentd.conf
                servers=`grep -im1 ^Server= ${cfg} | cut -f2 -d= | sed 's/,/ /g'`
                sendvalue() {
                
                    for s in ${servers}
                      do
                      ${sender} "${s}" "${sport}" "${hostname}" $1 $2
                    done
                }
                ... which is not very clean way of doing so.

                Comment

                • RandySpinaGE
                  Member
                  • Jun 2006
                  • 57

                  #9
                  This thread is 2 issues

                  Please understand that we are talking about 2 things here.

                  1 - how to send multiple item_values back
                  1a - using zabbix_sender called multiple times (or using cat | ...sender) is not so.. bad and available today.
                  1b - or upgrading zabbix_agentd to understand a "list" of values ... not available

                  2 - alj, you give zabbix_sender examples twice but don't comment on who schedules (runs the script with) zabbix_sender.
                  2a - "Int"s example outlines letting zabbix control when that is done. (In the eyes of a zabbix ADMIN this is ONE PLACE).
                  2b - no one was asking zabbix to create a scheduler program, it is just inherent.

                  I have since written 4 "get_custom_values" UserParameter scripts that each call zabbix_sender 12 times. The unit label is "returncode" (either 0 or 1).

                  The only negative outcome from this implementation is that my graphs are labeled "Zabbix_Server:name of graph" which is graphing a data item defined in the server but has real meaning from the agent (the system that does the sender). An agent that understands sending back a list would label the graph "Monitored_System:name of graph".

                  Thanks again,

                  rev 1.1.3
                  Last edited by RandySpinaGE; 03-01-2007, 00:24.

                  Comment

                  • crashdummyMCH
                    Member
                    • Jun 2006
                    • 33

                    #10
                    Put thin in documentation?

                    Alexei,
                    I found this so valuable for monitoring things like apache server-status pages that it should be included in the documentation. I was just glad that I happened to come across this thread.
                    Please consider posting at least a link to this thread in the documentation.

                    This is what saved Zabbix in our testing phase. Zabbix has since become our monitoring solution of choice for its ability to adapty to everything we through at it.
                    Thanks.

                    Comment

                    • dsipe
                      Senior Member
                      • Oct 2006
                      • 184

                      #11
                      One possibility that i'm allready using is to :

                      1) create as many item of type 'Zabbix trapper' as needed by things to monitor
                      2) create ONE item of type 'Zabbix agent[active], pointing to the UserParameter defined in your Zabbix client conf file.

                      This way, everything get inside Zabbix [ no need to look @ different crontab or at windows list ] : the 2) item just "submit" the script, and the script then populate back the different trapper items.

                      Comment

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

                        #12
                        Originally posted by crashdummyMCH
                        I found this so valuable for monitoring things like apache server-status pages that it should be included in the documentation. I was just glad that I happened to come across this thread.
                        Please consider posting at least a link to this thread in the documentation.
                        I agree. Please check the latest PDF Manual. I believe some issues are already described there.
                        Alexei Vladishev
                        Creator of Zabbix, Product manager
                        New York | Tokyo | Riga
                        My Twitter

                        Comment

                        Working...