zabbix 5.2.6 监控进程
nginx wiki jira zabbix jumpserver 重启需要电话通知我们?
nginx 磁盘90%阈值需要电话通知我们?
解刨:进程重启需要电话通知给我们
关键点:如何才能知道进程重启了(可以通过获取进程的运行时间)
ps -p 进程pid -o etimes
system.run[ps -p $(sudo netstat -lntup|grep 10051|grep -v "tcp6"|awk '{print $NF}'|awk -F/ '{print $1}') -o etimes|tail -1|xargs echo]
# 10051 是进程的端口号
零零一:创建好的监控项如下图
零零二:附上模板,直接导入即可(把端口修改成对应进程的端口号)
cat zabbix.xml
<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>5.2</version> <date>2022-07-26T12:16:48Z</date> <groups> <group> <name>Linux servers</name> </group> </groups> <templates> <template> <template>Jumpserver by Zabbix agent active</template> <name>Jumpserver by Zabbix agent active</name> <groups> <group> <name>Linux servers</name> </group> </groups> <applications> <application> <name>Proc Running Time</name> </application> </applications> <items> <item> <name>Jumpserver Port 80 Running</name> <type>ZABBIX_ACTIVE</type> <key>net.tcp.listen[80]</key> <history>7d</history> <trends>7d</trends> <applications> <application> <name>Proc Running Time</name> </application> </applications> <triggers> <trigger> <expression>{last()}<>1</expression> <name>Jumpserver port not Running (Port:80)</name> <priority>DISASTER</priority> <manual_close>YES</manual_close> </trigger> </triggers> </item> <item> <name>Jumpserver Port 2222 Running</name> <type>ZABBIX_ACTIVE</type> <key>net.tcp.listen[2222]</key> <history>7d</history> <trends>7d</trends> <applications> <application> <name>Proc Running Time</name> </application> </applications> <triggers> <trigger> <expression>{last()}<>1</expression> <name>Jumpserver port not Running (Port:2222)</name> <priority>DISASTER</priority> <manual_close>YES</manual_close> </trigger> </triggers> </item> <item> <name>Jumpserver Proc Running Time</name> <type>ZABBIX_ACTIVE</type> <key>system.run[ps -p $(sudo netstat -lntup|grep 2222|awk '{print $NF}'|awk -F/ '{print $1}') -o etimes|tail -1|xargs echo]</key> <history>7d</history> <trends>7d</trends> <applications> <application> <name>Proc Running Time</name> </application> </applications> <triggers> <trigger> <expression>{last()}<120</expression> <name>Jumpserver proc has been restarted (uptime < 2m)</name> <priority>DISASTER</priority> <manual_close>YES</manual_close> </trigger> </triggers> </item> </items> </template> </templates> </zabbix_export>
分类:
zabbix
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通