您的位置:首页 > 运维架构

zabbix3.2监控IBM硬件报错信息

2017-08-16 22:28 543 查看
vim chk_ibm

channel=(15 31 32 33 34 41 42 43 44 45 46 47 48 49 50 51 52 54 55 56 57 58 61 63 68 72 80 81 83 84 90 91 92 93 94 95 96 97 98 99 100 101 102 104 105 107 108 110 111 112 113 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135)
length=${#channel[@]}
#echo "$length"
printf "{\n"
printf  '\t'"\"data\":["
for ((i=0;i<$length;i++))
do
printf '\n\t\t{'
printf "\"{#IBM_SNMP}\":\"${channel[$i]}\"}"
if [ $i -lt $[$length-1] ];then
printf ','
fi
done
printf  "]}\n"
执行结果
sh chk_ibm
{
"data":[
{"{#IBM_SNMP}":"15"},
{"{#IBM_SNMP}":"31"},
{"{#IBM_SNMP}":"32"},
{"{#IBM_SNMP}":"33"},
{"{#IBM_SNMP}":"34"},
{"{#IBM_SNMP}":"41"},
{"{#IBM_SNMP}":"42"},
{"{#IBM_SNMP}":"43"},
{"{#IBM_SNMP}":"44"},
{"{#IBM_SNMP}":"45"},
{"{#IBM_SNMP}":"46"},
{"{#IBM_SNMP}":"47"},
{"{#IBM_SNMP}":"48"},
{"{#IBM_SNMP}":"49"},
{"{#IBM_SNMP}":"50"},
{"{#IBM_SNMP}":"51"},
{"{#IBM_SNMP}":"52"},
{"{#IBM_SNMP}":"54"},
{"{#IBM_SNMP}":"55"},
{"{#IBM_SNMP}":"56"},
{"{#IBM_SNMP}":"57"},
{"{#IBM_SNMP}":"58"},
{"{#IBM_SNMP}":"61"},
{"{#IBM_SNMP}":"63"},
{"{#IBM_SNMP}":"68"},
{"{#IBM_SNMP}":"72"},
{"{#IBM_SNMP}":"80"},
{"{#IBM_SNMP}":"81"},
{"{#IBM_SNMP}":"83"},
{"{#IBM_SNMP}":"84"},
{"{#IBM_SNMP}":"90"},
{"{#IBM_SNMP}":"91"},
{"{#IBM_SNMP}":"92"},
{"{#IBM_SNMP}":"93"},
{"{#IBM_SNMP}":"94"},
{"{#IBM_SNMP}":"95"},
{"{#IBM_SNMP}":"96"},
{"{#IBM_SNMP}":"97"},
{"{#IBM_SNMP}":"98"},
{"{#IBM_SNMP}":"99"},
{"{#IBM_SNMP}":"100"},
{"{#IBM_SNMP}":"101"},
{"{#IBM_SNMP}":"102"},
{"{#IBM_SNMP}":"104"},
{"{#IBM_SNMP}":"105"},
{"{#IBM_SNMP}":"107"},
{"{#IBM_SNMP}":"108"},
{"{#IBM_SNMP}":"110"},
{"{#IBM_SNMP}":"111"},
{"{#IBM_SNMP}":"112"},
{"{#IBM_SNMP}":"113"},
{"{#IBM_SNMP}":"121"},
{"{#IBM_SNMP}":"122"},
{"{#IBM_SNMP}":"123"},
{"{#IBM_SNMP}":"124"},
{"{#IBM_SNMP}":"125"},
{"{#IBM_SNMP}":"126"},
{"{#IBM_SNMP}":"127"},
{"{#IBM_SNMP}":"128"},
{"{#IBM_SNMP}":"129"},
{"{#IBM_SNMP}":"130"},
{"{#IBM_SNMP}":"131"},
{"{#IBM_SNMP}":"132"},
{"{#IBM_SNMP}":"133"},
{"{#IBM_SNMP}":"134"},
{"{#IBM_SNMP}":"135"}]}

配置Zabbix配置文件

vim ../zabbix_agentd.d/zabbix_ibm.conf 

UserParameter=check_ibm[*],sh /etc/zabbix/shells/chk_ibm
UserParameter=check_snmp[*],sh /etc/zabbix/shells/chk_snmp_ibm $1 $2 $3

 

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: