温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

使用zabbix监控K8s出现异常POD的解决方法

发布时间:2020-11-16 17:04:06 阅读:848 作者:Leah 栏目:云计算
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

今天就跟大家聊聊有关使用zabbix监控K8s出现异常POD的解决方法,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

通过监控异常的pod,及时发现k8s存在的问题。原理是使用kubectl get pod –all-namespaces,找到ready列,如果ready数量与desire数量不一致的,或者非RUNNING的状态POD,则认为这个pod异常,,进而告警。

配置agent监控项

/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?><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模板。

看完上述内容,你们对使用zabbix监控K8s出现异常POD的解决方法有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注亿速云行业资讯频道,感谢大家的支持

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×