2020-03-13 17:41:14
通过监控异常的pod,及时发现k8s存在的问题。原理是使用kubectl get pod –all-namespaces,找到ready列,如果ready数量与desire数量不一致的,或者非RUNNING的状态POD,则认为这个pod异常,,进而告警。
/etc/zabbix/zabbix_agentd.d/k8s.conf
UserParameter=abnormal.pod, kubectl get pod --all-namespaces -o wide | awk 'NR>1{cmd="echo "$3" | bc";cmd|getline ret;close(cmd);if (ret != 1 || $4 != "Running"){print}}'
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.2</version>
<date>2017-06-16T03:51:42Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template App K8s</template>
<name>Template App K8s</name>
<description/>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>k8s</name>
</application>
</applications>
<items>
<item>
<name>abnormal pod</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>abnormal.pod</key>
<delay>60</delay>
<history>90</history>
<trends>0</trends>
<status>0</status>
<value_type>4</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>k8s</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
</items>
<discovery_rules/>
<httptests/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template App K8s:abnormal.pod.strlen()}<>0</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>abnormal pod</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>2</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger>
</triggers>
</zabbix_export>
找到能执行kubectl的节点,添加k8s模板。
kubernetes集群使用Ceph
03-20
K8s(kubernetes) kube-proxy转发模式及service转发类型介绍
05-19
K8s(kubernetes)部署三个节点的redis cluster
05-24
zabbix监控Memcached状态
04-13
docker部署zabbix监控系统(nginx mysql)
06-28
zabbix配置percona的插件获取更详细的mysql监控信息
03-16
使用zabbix根据时间监控多行格式的日志
04-03
使用zabbix自动发现自动监控多tomcat实例
05-16
使用Selenium抓取zabbix性能监控图
02-15
zabbix3.0监控Apache2.4服务器状态
07-17
zabbix3监控Nginx性能状态
04-09
zabbix使用Pycurl模块监控web页面状态
06-23
Lvs自动部署及监控shell脚本
04-11
Win10 RS2(1703)应用闪退、异常的处理方法
06-16
cacti监控磁盘IO
07-23
“联想云盘服务器连接异常”的解决方法
05-19
为什么I750的TV输出与个别电视连接时候出现异常的现象?
04-03
使用宽带上网时,拨号异常
06-10
具有AMT功能的主板DIMM1插槽没有插入内存时开机风扇声音异常大
07-03
如何在 Laravel 中使用 Slack 进行异常通知
05-25
Netlimiter (互联网流量监控工具) v4.1.10.0 破解版
7.2M
下载Sidebar Diagnostics(电脑硬件监控软件) v3.5.9 官方版
3.73M
下载TP-LINK安防系统(远程视频监控软件) v2.10.5.138 电脑版
107.4M
下载dvr4000监控软件下载
17.5M
下载楼月键盘屏幕全记录(电脑监控软件) v3.4 破解版
955KB
下载网路岗(网络监控软件)9.03.60 免费版
28.3M
下载网路岗8(上网行为监控软件)破解版
45.22MB
下载长角牛网络监控机下载
2.8M
下载Directory Monitor下载
6.5M
下载Nektra SpyStudio下载
39.0M
下载OpenWebMonitor下载
51.1M
下载Simplewall下载
696.6K
下载局域网查看工具下载
0.33MB
下载掌上看家采集端下载
6.1M
下载海康播放器下载
24.9M
下载