Ad Widget

Collapse

How to insert both timestamp and data item?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dogsled23
    Junior Member
    • Sep 2010
    • 6

    #1

    How to insert both timestamp and data item?

    I need to read information from a flat file generated by the 'topasrec' utility on AIX 5.3, and insert it into Zabbix. Currently, I have an external script that's working to insert the data items I want, but the source file is updated only every 15 minutes, and then copied to my Zabbix server, so the ACTUAL timestamp when the item was recorded in the flat file may be much earlier than the timestamp that is automatically generated when the item is inserted into Zabbix. This could result in misleading interpretation of the data.

    Does anyone know of a way to actively post both a timestamp and a data item into Zabbix?

    I realize that I could write a perl DBI script to post the data into the MySQL database, however Zabbix must be updated through the "normal"method so that the data can be reported and graphed. This would result in double-posting of the data, and half the rows in the table would have incorrect timestamps.

    Any ideas?
  • alixen
    Senior Member
    • Apr 2006
    • 474

    #2
    Hi,

    Originally posted by dogsled23
    Does anyone know of a way to actively post both a timestamp and a data item into Zabbix?
    Any ideas?
    Statrting with 1.8, zabbix_sender can do that.
    Check -T option (http://www.zabbix.com/documentation/.../zabbix_sender)

    Regards,
    Alixen
    http://www.alixen.fr/zabbix.html

    Comment

    • dogsled23
      Junior Member
      • Sep 2010
      • 6

      #3
      Thanks...

      Thanks, I'll give this a try.
      Actually, I'd already written a more complex script using Perl/DBI-> MySQL that posts information to the 'history' table in the Zabbix database. But, zabbix_sender looks much simpler, and simplicity is a virtue in my book.

      Comment

      • dogsled23
        Junior Member
        • Sep 2010
        • 6

        #4
        Piping to zabbix_sender

        Since you seem to have some experience with zabbix_sender, I was wondering if you've attempted to pipe information to it, rather than picking up information from a flat file, like this:

        data_generating_program | zabbix_sender -<options> -i

        AND, would you use the -i option? I would think not, since -i requires you to name the file.

        Also, I would guess that the typical use of zabbix_sender would be in an external script.

        Thanks.
        Last edited by dogsled23; 18-09-2010, 18:43. Reason: more questions

        Comment

        • alixen
          Senior Member
          • Apr 2006
          • 474

          #5
          Hi,

          Originally posted by dogsled23
          Since you seem to have some experience with zabbix_sender, I was wondering if you've attempted to pipe information to it, rather than picking up information from a flat file, like this:

          data_generating_program | zabbix_sender -<options> -i

          AND, would you use the -i option? I would think not, since -i requires you to name the file.

          Also, I would guess that the typical use of zabbix_sender would be in an external script.

          Thanks.
          Sorry, I use zabbix_sender very often in external scripts but I haven't played yet with "new" features introduced in 1.8.
          However, according to Zabbix documentation
          Code:
          data_generating_program | zabbix_sender -i -
          should be OK.

          Regards,
          Alixen
          http://www.alixen.fr/zabbix.html

          Comment

          • dogsled23
            Junior Member
            • Sep 2010
            • 6

            #6
            zabbix_sender

            Alixen:

            Thanks for the tips.
            I had already tried the -I - option for piping output from another program, and it works.
            One other piece of trivia that a "newbie" (like me) needs to know, and is not stated in the documentation: the "receiving" item type for zabbix_sender must be zabbix_trap.
            I accidentally stumbled across that hint in another forum thread.
            Do you know whether any other item type will work with zabbix_sender?

            Thanks again for your help.
            dogsled23
            Last edited by dogsled23; 20-09-2010, 18:57. Reason: enhance text

            Comment

            • alixen
              Senior Member
              • Apr 2006
              • 474

              #7
              Hi,

              Originally posted by dogsled23
              Do you know whether any other item type will work with zabbix_sender?
              AFAIK no, "zabbix trapper" type is THE type needed for items coming from zabbix_sender.
              Just to be complete, it is also used for SNMP traps but this is due the fact that snmptrap.sh uses zabbix_sender internally to forward SNMP traps to Zabbix.

              Regards,
              Alixen
              http://www.alixen.fr/zabbix.html

              Comment

              • nmattox
                Junior Member
                • May 2009
                • 5

                #8
                Good info re: SNMP trap

                Alixen:
                Thanks for the complete reply; also, it's good to know about SNMP trap. I've been using SNMP, but only in a "pull" mode, i.e., snmpget, snmpwalk, etc., from the server-side.
                Thanks again.
                dogsled23

                Comment

                • dogsled23
                  Junior Member
                  • Sep 2010
                  • 6

                  #9
                  zabbix_sender &gt; zabbix_trapper has stopped!

                  In the past week, I had got zabbix_sender to zabbix_trapper working great, with 17 different hosts being reported on, for five different metrics each.
                  All of a sudden, today, several (but not all) of the hosts stopped receiving information on them, without any changes having been made to the configuration.

                  Getting this:

                  Info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000024"
                  sent: 1; skipped: 0; total: 1
                  Info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000023"
                  sent: 1; skipped: 0; total: 1

                  Why would this happen spontaneously?
                  Are there log files anywhere that I could look at?

                  Thanks.
                  dogsled23
                  Last edited by dogsled23; 28-09-2010, 23:43. Reason: correct error

                  Comment

                  • alixen
                    Senior Member
                    • Apr 2006
                    • 474

                    #10
                    Hi,

                    Originally posted by dogsled23
                    In the past week, I had got zabbix_sender to zabbix_trapper working great, with 17 different hosts being reported on, for five different metrics each.
                    All of a sudden, today, several (but not all) of the hosts stopped receiving information on them, without any changes having been made to the configuration.

                    Getting this:

                    Info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000024"
                    sent: 1; skipped: 0; total: 1
                    Info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000023"
                    sent: 1; skipped: 0; total: 1

                    Why would this happen spontaneously?
                    Are there log files anywhere that I could look at?

                    Thanks.
                    dogsled23
                    Since your question is not really related to original topic of this thread, you'd have more visibility by starting your own thread.

                    Anyway, you are getting "Processed 0 Failed 1 Total 1 Seconds spent 0.000024", so your server is rejecting these data. You should first look at zabbix-server.log (probably in /var/log/zabbix-server directory).

                    Regards,
                    Alixen
                    http://www.alixen.fr/zabbix.html

                    Comment

                    • nmattox
                      Junior Member
                      • May 2009
                      • 5

                      #11
                      zabbix_sender spontaneously failing

                      Thanks for the suggestion about starting a new thread.
                      I checked the log files and nothing jumped out.
                      As a test, I completely wiped out one of the affected hosts, then recreated it by doing a "full clone" of another host, and data collection has resumed. It will be interesting to see if it decides to conk out again.

                      Comment

                      Working...