Ad Widget

Collapse

zabbix'database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dennis_cao
    Junior Member
    • May 2008
    • 13

    #1

    zabbix'database

    i want to create a shell script to detect the zabbix trigger's status
    what is the table should i to detect
    or some one can tell me the sql ?
    many thanks
  • Tenzer
    Senior Member
    • Nov 2007
    • 316

    #2
    I'm pretty sure that has been talked about on the forums before. Have you tried to search for it?

    Comment

    • vinny
      Senior Member
      • Jan 2008
      • 145

      #3
      2 tables : triggers & trigger_depends if u have set dependancies.
      -------
      Zabbix 1.8.3, 1200+ Hosts, 40 000+ Items...zabbix's everywhere

      Comment

      • bbrendon
        Senior Member
        • Sep 2005
        • 870

        #4
        I have a feeling its a little more complex than that. Especially if you relate it to acknowledgements.
        Unofficial Zabbix Expert
        Blog, Corporate Site

        Comment

        • dennis_cao
          Junior Member
          • May 2008
          • 13

          #5
          I am sorry i dont search it before
          i will search it . but which filed should i fixed?
          thanks
          Last edited by dennis_cao; 14-06-2008, 05:22.

          Comment

          • dennis_cao
            Junior Member
            • May 2008
            • 13

            #6
            i just do this
            select * from triggers where status = 1;
            ouput Empty set (0.00 sec)

            but there is a | Triggers value is true
            why?
            what i need to to extract triggers that are currently TRUE (eg, from tr_status.php) from a Mysql console
            Attached Files
            Last edited by dennis_cao; 15-06-2008, 11:30.

            Comment

            • dennis_cao
              Junior Member
              • May 2008
              • 13

              #7
              Who can guide me ?
              Online wait
              thanks

              Comment

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

                #8
                Try this query instead.

                Code:
                select * from triggers where status=0 and value=1;
                I think the status field is related to weather or not the host is online/offline/enabled/disabled. Same is true for the value field.

                I hope that was of some help. :-)
                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

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

                  #9
                  Ok... I dug a little deeper... I didn't like the other queries results.

                  Try this...

                  Code:
                  select f.triggerid, t.expression, f.functionid, f.lastvalue, f.function, f.parameter, i.key_, h.host 
                    from functions as f 
                    left join items as i on f.itemid=i.itemid 
                    left join hosts as h on i.hostid = h.hostid 
                    left join triggers as t on f.triggerid = t.triggerid 
                    where f.triggerid in 
                      (select triggerid from triggers where value=1 and status=0)
                    order by f.triggerid;
                  And a sample result:
                  Code:
                  +-----------+-------------------------+------------+--------------+----------+-----------+------------------------------+----------------+
                  | triggerid | expression              | functionid | lastvalue    | function | parameter | key_                         | host           |
                  +-----------+-------------------------+------------+--------------+----------+-----------+------------------------------+----------------+
                  |     22016 | ({28682})<({28683}*0.1) |      28682 | 22122552000  | last     | 0         | vfs.fs.size[/space,free]     | dabus.prod     |
                  |     22016 | ({28682})<({28683}*0.1) |      28683 | 245089772000 | last     | 0         | vfs.fs.size[/space,total]    | dabus.prod     |
                  |     21516 | {30984}=1               |      30984 | 1            | nodata   | 300       | agent.ping                   | runka.prod     |
                  |     21288 | {34207}>2500            |      34207 | 3956         | min      | 1800      | diskq.counter[block,dbqueue] | response2.prod |
                  |     21289 | {34208}>2500            |      34208 | 17487        | min      | 1800      | diskq.counter[block,dbqueue] | response3.prod |
                  |     21290 | {34209}>2500            |      34209 | 9358         | min      | 1800      | diskq.counter[block,dbqueue] | response4.prod |
                  +-----------+-------------------------+------------+--------------+----------+-----------+------------------------------+----------------+
                  6 rows in set (0.13 sec)
                  As you can see this will return you a nice neat little table that will tell you which "functions" are members of a trigger which is "true". If you have a trigger with multiple items you will see that query listed multiple times. If you don't wish to you can add "group by f.triggerid" to the end of the query and you will then only see the trigger listed once. If you do a group by statement and the trigger is dependent on multiple hosts you will only see one of the hosts in the resultant query.

                  Hopefully this helps a little more. :-)
                  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

                  • dennis_cao
                    Junior Member
                    • May 2008
                    • 13

                    #10
                    thanks i will try it

                    Comment

                    • dennis_cao
                      Junior Member
                      • May 2008
                      • 13

                      #11
                      there is too many result about

                      100100000012199 | {100100000011199}>0 | icmpOutParmProbs on {HOSTNAME} is too High | | 0 | 1 | 3 | 0 | 0 | | | 0 | 0 |
                      | 100100000012200 | {100100000011200}>0 | icmpOutSrcQuenchs on {HOSTNAME} is too High | | 0 | 1 | 3 | 0 | 0 | | | 0 | 0 |
                      | 100100000012201 | {100100000011201}>150000 | icmpOutRedirects on {HOSTNAME} is too High | | 0 | 1 | 3 | 0 | 0 | | | 0 | 0 |

                      but i dont use the trigger
                      i delete the trigger temp 'Template_SNMPv2_Device'
                      it also exist
                      Last edited by dennis_cao; 18-06-2008, 04:42.

                      Comment

                      Working...