Ad Widget

Collapse

Is it possible to export zabbix statistical datas in Cacti?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fatiha
    Member
    • Nov 2007
    • 78

    #1

    Is it possible to export zabbix statistical datas in Cacti?

    Hi,

    Has anyone done an export of statistical data in cacti?

    Thanks,
    Fatiha
  • fatiha
    Member
    • Nov 2007
    • 78

    #2
    I want to give you more details.

    I want to :
    1- export statistical datas from history table and convert those datas in RRDTool's format => zabbixBase.rrd

    2- import zabbixBase.rrd in Cacti

    3- generate graphs in Cacti

    So, I have some problems with the first step. Has anyone done something like that?

    Thank you,
    Fatiha

    Comment

    • Tenzer
      Senior Member
      • Nov 2007
      • 316

      #3
      I don't think that there currently is any way of exporting the data/history from Zabbix. Then you would have to extract it directly from the database.

      Comment

      • fatiha
        Member
        • Nov 2007
        • 78

        #4
        Ok so I hope it will be done in a future release.

        Thanks for your answer.

        Comment

        • hirschnf
          Member
          • Jan 2010
          • 56

          #5
          Hello,

          did somebody evaluate a solution to export data from zabbix to cacti?

          Or is there a way to export data automatically from zabbix (server or agent) to a simple text file for example?

          Thanks
          Frank

          Comment

          • nelsonab
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2006
            • 1233

            #6
            If you want I can add that feature to Zabcon. When the API supports getting data points then I can work on adding that feature to Zabcon for you. Head to http://trac.red-tux.net and open a ticket for the request.
            RHCE, author of zbxapi
            Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
            Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

            Comment

            • hirschnf
              Member
              • Jan 2010
              • 56

              #7
              Hello nelsonab,

              I didn't here something about zabcon.
              Perhaps it will be a way to export history data from the zabbix server. If I have these values in a text file it will be possible to import them to other programs.

              Indeed a combination of [unix-ts]:[value] will be perfect to implement it to rrd-tool.


              Thanks
              Frank

              Comment

              • nelsonab
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2006
                • 1233

                #8
                There have been a few News posts in the wiki about Zabcon and it's been in my sig for a while now. :-)

                Even if something like this does not get directly implimented in Zabcon it will eventually be possible to do something like

                Code:
                zabcon -l get item itemid=id start=time end=time
                This would then present you with a table from the Zabbix server you have defined in the Zabcon conf file. You can then take that output and parse it with a bash script or something else.

                I don't exactly know how that command will look but before I can do that there needs to be API access to item history.
                RHCE, author of zbxapi
                Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                Comment

                • Jun.Liu
                  Member
                  • Apr 2007
                  • 91

                  #9
                  I had wrote a python script to do this job on 1.6.6. you can try it according to below steps:

                  - upload the data2txt.py to Zabbix server.
                  - create a config file for the data you want to export from history db.

                  example: ggsn_traffics.ini
                  dbuser=zabbix
                  dbpassword=zabbix
                  2009-09-30,14D
                  GGSN1, Gi Input
                  GGSN1, Gi Output
                  GGSN2, Gi Input
                  GGSN2, Gi Output
                  # line1: specify the username for MySQL login.
                  # line2: specify the password for MySQL login
                  # line3: specify the start date and duration of the history date. "14D" means 14 days, 'W' means week....
                  # line4~:list the Hostname and the key of the item you want to export. use ',' to separate them.

                  - run the script:
                  Code:
                  python db2txt.py -c ggsn_traffics.ini
                  - when script finish, 4 files (one file for each item) will be generated at current directory. the file will contain the clock and item value like this:

                  Code:
                  #[host]="GGSN1"
                  #[item]="Gi Input"
                  #[fields]="clock","value"
                  1254240182	24719
                  1254240250	4544
                  1254240346	7477
                  1254240466	8637
                  1254240605	9927
                  1254240708	7030
                  1254240828	8481
                  1254240985	10905
                  .....
                  Attached Files
                  Last edited by Jun.Liu; 30-01-2010, 17:15.

                  Comment

                  • srupp
                    Junior Member
                    • Apr 2011
                    • 11

                    #10
                    Does anyone know if this python script works anymore?

                    I have Zabbix 1.8.4 under Ubuntu 10 and I attempted to use this.

                    I created the INI file to pass at the shell but it just runs and runs without a seeming end. I never see any output files in the dir that has the script and the INI residing.

                    Any comments would be appreciated.

                    This was my INI:

                    root@zabbix:/python# cat asa.ini
                    dbuser=someuser
                    dbpassword=somepassword
                    2011-12-31,1D
                    ASA-1, asa_cpu

                    Gracias!
                    Stephen
                    Last edited by srupp; 04-01-2012, 00:41.

                    Comment

                    • Jun.Liu
                      Member
                      • Apr 2007
                      • 91

                      #11
                      I'm not sure if the table structure had been changed in 1.8.6. since I don't have the 1.8.6 version installed. please try below sql command in your shell to check if the data are fetch correctly. this command is what the python script do as well actually.

                      mysql -usomeuser -psomepasswd -D zabbix -e \
                      "select clock,value from history_uint,hosts,items \
                      where history_uint.itemid=items.itemid and \
                      hosts.hostid=items.hostid and \
                      hosts.host='ASA-1' and items.description='asa_cpu' and \
                      clock>1325260800 and clock<1325260800;"
                      you can get the 'clock' value with this command:

                      Code:
                      ~$ date +%s -d'2011-12-31 00:00:00'
                      1325260800
                      ~$ date +%s -d'2011-12-31 23:59:59'
                      1325347199

                      Comment

                      • srupp
                        Junior Member
                        • Apr 2011
                        • 11

                        #12
                        Jun,

                        Thank you for taking the time to post back and share your insights. (Very good info on the date syntax.)

                        I used the command and it executed and immediately returned no data.

                        I'm at a loss as to how to effectively look into this farther since I lack DB skills. If you wouldn't mind tossing me a few more suggestions or resources for reading, I'm always eager to learn and experiment.

                        Comment

                        • Jun.Liu
                          Member
                          • Apr 2007
                          • 91

                          #13
                          it looks like the host or the item was not found in the database. please check if the host and item are correct or use below sql commands to check if they are in database:

                          Check if the host ASA-1 in hosts table:
                          mysql -usomeuser -psomepasswd -D zabbix -e "select hostid,host from hosts;"
                          check if the host ASA-1 has the item 'asa_cpu':
                          mysql -usomeuser -psomepasswd -D zabbix -e \
                          "select hosts.host,itemid,description from items,hosts \
                          where hosts.hostid=items.hostid and \
                          hosts.host not like 'Template%';"
                          Actually I'm a newbie for DB as well, but the SQL language is quite friendly and easily to learn and there is million stuff about it in the web. try to find a basic tutorial and you should make it.
                          Last edited by Jun.Liu; 05-01-2012, 17:13.

                          Comment

                          Working...