Ad Widget

Collapse

Query active problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • high-t
    Member
    • Dec 2014
    • 68

    #1

    Query active problems

    Hi.

    I'm looking for a way of determining how many problems are currently active (not resolved).
    Didn't find such an item in the Zabbix Internal nor Zabbix Aggregate types of items. I would rather refrain from querying Zabbix DB directly, as future changes might alter the schema.

    Thank you in advance!

    Amit.
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    Hi, in that case you could build a script using Zabbix API to query the data you need. Then you can use a trapper item to store and graph that as you need.

    Markku

    Comment

    • high-t
      Member
      • Dec 2014
      • 68

      #3
      Hmm.. interesting. So in a sense: have Zabbix query itself with an "external" script .
      I can do that NP.
      10X

      Comment

      • ingus.vilnis
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Mar 2014
        • 908

        #4
        Hi,

        I went the direct DB way since MySQL internal monitoring was already configured. Just added few user parameters on the DB server to be queried every minute.

        Zabbix - Number of Open Problems - Total
        Code:
        UserParameter=zabbix.problems.open.total,HOME=/etc/zabbix mysql -N -e "USE zabbix; SELECT count(*) FROM problem WHERE source = 0 AND object = 0 AND r_eventid IS NULL;"
        And per each severity from 0 till 5.
        Zabbix - Number of Open Problems - 0 Not classified
        Code:
        UserParameter=zabbix.problems.open[*],HOME=/etc/zabbix mysql -N -e "USE zabbix; SELECT count(*) FROM problem WHERE source = 0 AND object = 0 AND r_eventid IS NULL AND severity = $1;"
        Afterwards create a stacked graph and enjoy.

        And in case you wonder why you are seeing more problems in the graph that you would in the "Problems" page - the answer is in Dependent triggers.

        Comment

        • high-t
          Member
          • Dec 2014
          • 68

          #5
          Originally posted by ingus.vilnis
          Hi,

          I went the direct DB way since MySQL internal monitoring was already configured. Just added few user parameters on the DB server to be queried every minute.
          Thank you, ingus.vilnis for the idea. I did think of querying the DB, but I see two downsides for this approach:
          1. Schema is bound to changes as new versions becomes available.
          2. I need to be able to isolate problems associated with specific host group(s).

          The API approach offers solution to the above, so I went that path and have already wrote the script. It was no-brainer.

          Makes sense?

          Comment

          • ingus.vilnis
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Mar 2014
            • 908

            #6
            Sure. Glad you have a solution already.

            Comment

            Working...