Zabbix的trigger就是用來(lái)設(shè)置監(jiān)控報(bào)警條件的,如果監(jiān)控項(xiàng)目是基于模板的,那么直接在創(chuàng)建模板的時(shí)候設(shè)置相應(yīng)item的trigger即可,如果監(jiān)控項(xiàng)目不是基于模板的而是單獨(dú)添加的,那么對(duì)于多臺(tái)服務(wù)器添加相應(yīng)的trigger就得使用程序處理了。
創(chuàng)新互聯(lián)建站致力于互聯(lián)網(wǎng)網(wǎng)站建設(shè)與網(wǎng)站營(yíng)銷(xiāo),提供成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、網(wǎng)站開(kāi)發(fā)、seo優(yōu)化、網(wǎng)站排名、互聯(lián)網(wǎng)營(yíng)銷(xiāo)、微信平臺(tái)小程序開(kāi)發(fā)、公眾號(hào)商城、等建站開(kāi)發(fā),創(chuàng)新互聯(lián)建站網(wǎng)站建設(shè)策劃專(zhuān)家,為不同類(lèi)型的客戶(hù)提供良好的互聯(lián)網(wǎng)應(yīng)用定制解決方案,幫助客戶(hù)在新的全球化互聯(lián)網(wǎng)環(huán)境中保持優(yōu)勢(shì)。創(chuàng)建trigger相關(guān)的源代碼
frontends/php/include/triggers.inc.php
frontends/php/triggers.php
triggers表用于記錄每個(gè)trigger的詳細(xì)信息
mysql> desc triggers; +-------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------+-------+ | triggerid | bigint(20) unsigned | NO | PRI | NULL | | | expression | varchar(2048) | NO | | | | | description | varchar(255) | NO | | | | | url | varchar(255) | NO | | | | | status | int(11) | NO | MUL | 0 | | | value | int(11) | NO | MUL | 0 | | | priority | int(11) | NO | | 0 | | | lastchange | int(11) | NO | | 0 | | | comments | text | NO | | NULL | | | error | varchar(128) | NO | | | | | templateid | bigint(20) unsigned | YES | MUL | NULL | | | type | int(11) | NO | | 0 | | | state | int(11) | NO | | 0 | | | flags | int(11) | NO | | 0 | | +-------------+---------------------+------+-----+---------+-------+ 14 rows in set (0.12 sec)
functions表記錄每個(gè)trigger相關(guān)的函數(shù)
mysql> desc functions; +------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------------+------+-----+---------+-------+ | functionid | bigint(20) unsigned | NO | PRI | NULL | | | itemid | bigint(20) unsigned | NO | MUL | NULL | | | triggerid | bigint(20) unsigned | NO | MUL | NULL | | | function | varchar(12) | NO | | | | | parameter | varchar(255) | NO | | 0 | | +------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.00 sec)
trigger_depends表記錄不同trigger的依賴(lài)關(guān)系
mysql> desc trigger_depends; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ | triggerdepid | bigint(20) unsigned | NO | PRI | NULL | | | triggerid_down | bigint(20) unsigned | NO | MUL | NULL | | | triggerid_up | bigint(20) unsigned | NO | MUL | NULL | | +----------------+---------------------+------+-----+---------+-------+ 3 rows in set (0.01 sec)
triggers表通過(guò)triggerid與functions表關(guān)聯(lián),functions表通過(guò)itemid與items表關(guān)聯(lián),而items表可以通過(guò)hostid與hosts表關(guān)聯(lián)
根據(jù)triggerid查找trigger信息
SELECT t.* FROM triggers t WHERE t.triggerid=13073;
根據(jù)triggerid查找hosts
select distinct h.* from hosts h,functions f,items i where i.itemid=f.itemid and h.hostid=i.hostid and triggerid=13073\G
根據(jù)hostid查找所有的triggers
select distinct t.* from triggers t,functions f,items i where f.itemid=i.itemid and f.triggerid=t.triggerid and i.hostid=10309;
根據(jù)trigger描述和host名稱(chēng)獲取所有的triggers
select t.* from triggers t,functions f,items i ,hosts h where i.hostid=h.hostid and f.itemid=i.itemid and t.triggerid=f.triggerid and h.host='tw-xxxxxx' and t.description='Processor load is too high on {HOST.NAME}' order by t.triggerid desc;
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。