Zabbix Monitoring A service, such as Crond,zabbix itself without this template, requires manual script writing
Scenario Description:
192.168.10.10:zabbix Server
192.168.10.11:zabbix Client
2: Script contents are as follows:
[email protected] scripts]# pwd
/etc/zabbix/scripts
[email protected] scripts]# cat check_process_running
#!/bin/sh
###################################################
#
# Check Process runing status
#
###################################################
procjetname= "${1:-null}"
lock_path= "/var/lock/subsys"
run_path= "/var/run"
ret_ok=1
ret_warn=2
ret_critical=3
ret_unknown=4
if [[${procjetname} = = "NULL"]]; Then
Echo ${ret_unknown}
fi
if [-F "${lock_path}/${procjetname}"] | | [-F "${run_path}/${procjetname}.pid"]; Then
Echo ${RET_OK}
Else
Echo ${ret_critical}
fi
[email protected] zabbix_agentd.conf.d]# pwd
/etc/zabbix/zabbix_agentd.d
[email protected] zabbix_agentd.conf.d]# ll check_process.conf
-rw-r--r--1 root root 533 Dec check_process.conf
[email protected] zabbix_agentd.d]# cat check_process.conf
userparameter=check.crontab,/etc/zabbix/scripts/check_process_running Crond # # Note that the check.crontab must correspond to the key that is created under item
include related files on the Zabbix client machine,
[[email protected] etc]# ls
zabbix_agent.conf zabbix_agent.conf.d zabbix_agentd.conf zabbix_agentd.conf.d
[email protected] etc]# Cat zabbix_agentd.conf | grep-v "#" | grep-v "^$ "
Pidfile=/var/run/zabbix/zabbix_agentd.pid
Logfile=/var/log/zabbix/zabbix_agentd.log
Logfilesize=0
server=10.15.0.8
serveractive=127.0.0.1
Hostname=prod-public-ecs-aliyun
include=/etc/zabbix/zabbix_agentd.d/ # # #Include该文件!
3: The key point below is to get the value of Check.crontab key via Zabbix_get, which is required when creating trigger, otherwise
trigger expression is not filled in correctly, you cannot trigger trigger
Here's a template that I created with a template namedApptemplate, create a item,crond is running,update in the template interval I set to 5s, see attachment
650) this.width=650; "src=" Http://blog.chinaunix.net/attachment/201412/10/20776139_1418215526pPPA.png "height=" 641 "width=" 623 "style=" Border:0px;color:rgb (102,102,102); font-family: ' Song Body ', Arial;line-height:26px;white-space: Normal;background-color:rgb (255,255,255); "/>
then create a trigger,trigger named: Crond does not the work, with the expression value {apptemplate:check.crontab.last (0)}=3
Severity Select Disaster, click the Save button to create. See annex
650) this.width=650; "src=" Http://blog.chinaunix.net/attachment/201412/10/20776139_141821559967VF.png "height=" 405 "width=" "style=" Border:0px;color:rgb (102,102,102); font-family: ' Song Body ', Arial;line-height:26px;white-space: Normal;background-color:rgb (255,255,255); "/>
4: Then you can manually execute the service Crond stop on the 134 machine to see if the trigger trigger
650) this.width=650; "src=" Http://blog.chinaunix.net/attachment/201412/10/20776139_141821578345g7.png "height=" 91 "Width=" "style=" Border:0px;color:rgb (102,102,102); font-family: ' Arial ', Arial;line-height:26px;white-space: Normal;background-color:rgb (255,255,255); "/>
Zabbix Monitoring Crond Service