{"id":792,"date":"2017-07-25T22:00:11","date_gmt":"2017-07-26T01:00:11","guid":{"rendered":"http:\/\/wordpress.jpcorp.eti.br\/?p=792"},"modified":"2021-12-26T12:30:43","modified_gmt":"2021-12-26T15:30:43","slug":"number-of-triggers-problem","status":"publish","type":"post","link":"https:\/\/wordpress.jpcorp.eti.br\/?p=792","title":{"rendered":"Zabbix &#8211; N\u00famero de triggers com status problem"},"content":{"rendered":"<p>Indicador de problema com valor total para podermos ter vis\u00e3o do ambiente no todo.<\/p>\n<p>Neste caso ele ir\u00e1 apresentar o valor total de triggers em alerta em todas as prioridades:<\/p>\n<p><a href=\"http:\/\/wordpress.jpcorp.eti.br\/?attachment_id=793\" rel=\"attachment wp-att-793\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-793 alignnone\" src=\"http:\/\/wordpress.jpcorp.eti.br\/wp-content\/uploads\/2017\/03\/TRIGGERS_ACTIVE.png\" alt=\"\" width=\"879\" height=\"247\" srcset=\"https:\/\/wordpress.jpcorp.eti.br\/wp-content\/uploads\/2017\/03\/TRIGGERS_ACTIVE.png 879w, https:\/\/wordpress.jpcorp.eti.br\/wp-content\/uploads\/2017\/03\/TRIGGERS_ACTIVE-300x84.png 300w, https:\/\/wordpress.jpcorp.eti.br\/wp-content\/uploads\/2017\/03\/TRIGGERS_ACTIVE-768x216.png 768w, https:\/\/wordpress.jpcorp.eti.br\/wp-content\/uploads\/2017\/03\/TRIGGERS_ACTIVE-644x181.png 644w\" sizes=\"auto, (max-width: 879px) 100vw, 879px\" \/><\/a><\/p>\n<p>Discuss\u00e3o:\u00a0 <a href=\"http:\/\/wordpress.jpcorp.eti.br\/?attachment_id=794\" rel=\"attachment wp-att-794\">Monitoring_triggers_active<\/a><\/p>\n<h3>1 - Consultas no banco que retornam o resultado<\/h3>\n<pre class=\"lang:plsql decode:true\">SELECT count(t.triggerid) AS TRIGGERS_ACTIVE\r\n\tFROM triggers t, functions f, items i, hosts h \r\n\tWHERE t.triggerid=f.triggerid \r\n\tAND f.itemid=i.itemid \r\n\tAND i.status=0 \r\n\tAND i.hostid=h.hostid \r\n\tAND h.status=0 \r\n\tAND t.status=0 \r\n\tAND t.value=1;\r\n\t\r\n\t\r\nSELECT count(DISTINCT t.triggerid) AS TRIGGERS_ACTIVE\r\n\tFROM triggers t, functions f, items i, hosts h \r\n\tWHERE t.triggerid=f.triggerid \r\n\tAND f.itemid=i.itemid \r\n\tAND i.status=0 \r\n\tAND i.hostid=h.hostid \r\n\tAND h.status=0\r\n\tAND t.status=0 \r\n\tAND t.value=1;<\/pre>\n<p>&nbsp;<\/p>\n<h3>2 - UserParameter<\/h3>\n<pre class=\"lang:sh decode:true \"># vim \/etc\/zabbix\/zabbix_agentd.d\/userparameter_mysql.conf\r\n\r\n# echo \"SELECT count(DISTINCT t.triggerid) FROM triggers t, functions f, items i, hosts h WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.status=0 AND i.hostid=h.hostid AND h.status=0 AND t.status=0 AND t.value=1;\"|mysql -h 192.168.1.230 zabbix -s -u zabbix\r\n\r\nUserParameter=trigger.active,echo \"SELECT count(DISTINCT t.triggerid) FROM triggers t, functions f, items i, hosts h WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.status=0 AND i.hostid=h.hostid AND h.status=0 AND t.status=0 AND t.value=1;\"|mysql zabbix -s -u zabbix<\/pre>\n<p>&nbsp;<\/p>\n<h3>3 - Separando a prioridade<\/h3>\n<p><a href=\"https:\/\/www.zabbix.com\/documentation\/3.0\/manual\/api\/reference\/trigger\/object\">https:\/\/www.zabbix.com\/documentation\/3.0\/manual\/api\/reference\/trigger\/object<\/a><\/p>\n<p>0 - (default) not classified;\u00a01 - information;\u00a02 - warning;\u00a03 - average;\u00a04 - high;\u00a05 - disaster;<\/p>\n<pre class=\"lang:plsql decode:true \">SELECT count(DISTINCT t.triggerid) AS TRIGGERS_ACTIVE \r\n\tFROM triggers t, functions f, items i, hosts h \r\n\tWHERE t.triggerid=f.triggerid\r\n\tAND f.itemid=i.itemid\r\n\tAND i.status=0\r\n\tAND i.hostid=h.hostid\r\n\tAND h.status=0\r\n\tAND t.status=0\r\n\tAND t.value=1\r\n\tAND t.priority=5;<\/pre>\n<h4>UserParameter<\/h4>\n<pre class=\"lang:sh decode:true \">UserParameter=trigger.active[*],echo \"SELECT count(DISTINCT t.triggerid) AS TRIGGERS_ACTIVE FROM triggers t, functions f, items i, hosts h WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.status=0 AND i.hostid=h.hostid AND h.status=0 AND t.status=0 AND t.value=1 AND t.priority=$1;\"|mysql -h 192.168.1.230 zabbix -s -u zabbix<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Indicador de problema com valor total para podermos ter vis\u00e3o do ambiente no todo. Neste caso ele ir\u00e1 apresentar o valor total de triggers em alerta em todas as prioridades: Discuss\u00e3o:\u00a0 Monitoring_triggers_active 1 &#8211; Consultas no banco que retornam o resultado SELECT count(t.triggerid) AS TRIGGERS_ACTIVE FROM triggers t, functions f, items i, hosts h WHERE&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[46,41],"class_list":["post-792","post","type-post","status-publish","format-standard","hentry","category-zabbix","tag-mariadb","tag-zabbix"],"_links":{"self":[{"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/posts\/792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=792"}],"version-history":[{"count":10,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/posts\/792\/revisions"}],"predecessor-version":[{"id":900,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/posts\/792\/revisions\/900"}],"wp:attachment":[{"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}