新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Zabbix的trigger就是用来设置监控报警条件的,如果监控项目是基于模板的,那么直接在创建模板的时候设置相应item的trigger即可,如果监控项目不是基于模板的而是单独添加的,那么对于多台服务器添加相应的trigger就得使用程序处理了。
创新互联建站致力于互联网网站建设与网站营销,提供成都网站制作、成都网站设计、网站开发、seo优化、网站排名、互联网营销、微信平台小程序开发、公众号商城、等建站开发,创新互联建站网站建设策划专家,为不同类型的客户提供良好的互联网应用定制解决方案,帮助客户在新的全球化互联网环境中保持优势。创建trigger相关的源代码
frontends/php/include/triggers.inc.php
frontends/php/triggers.php
triggers表用于记录每个trigger的详细信息
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表记录每个trigger相关的函数
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的依赖关系
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表通过triggerid与functions表关联,functions表通过itemid与items表关联,而items表可以通过hostid与hosts表关联
根据triggerid查找trigger信息
SELECT t.* FROM triggers t WHERE t.triggerid=13073;
根据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
根据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;
根据trigger描述和host名称获取所有的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;
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。