利用zabbix监控3par光模块的发光功率

该文描述了一个通过配置ZabbixAgent、SSH连接和自定义用户参数来定时抓取并监控3par存储各模块功率的过程。步骤包括生成SSH密钥对,3par的信任设置,以及在Zabbix中设置定时任务和用户参数以获取并分析功率数据。
摘要由CSDN通过智能技术生成

总体思路是利用agent脚本定时抓取3par的各模块功率的具体值,利用定时任务获取功率值,然后分析处理数据,再塞到zabbix服务端,监控功率值的变化。

  1. 3par信任zabbix-agent的ssh连接

1.1 agent主机生成公钥key

ssh-keygen -t rsa -b 2048

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa): gz3par

未用DNS所以需要把key中的hostname改为IP

vi  gz3par.pub

行尾的root@hostname修改为root@ipaddr

1.2 3par执行信任主机ssh

gz3par cli% setsshkey

Please enter the SSH public key below. When finished, press enter twice.

The key is usually long. It's better to copy it from inside an editor

and paste it here. (Please make sure there are no extra blanks.)

The maximum number of characters used to represent the SSH key

(including the "from" option, key type, and additional comments) is 4095.

此处手动复制粘贴1.1中修改后的gz3par.pub全部内容

▒▒uUUUSSH public key successfully set.

gz3par cli%

1.3 agent主机执行测试

ssh -Tq -i /root/gz3par 3paradm@3parip

首次手动登录输入yes后,连接成功。

The authenticity of host 'xx.xx.xx.xx (xx.xx.xx.xx)' can't be established.

RSA key fingerprint is SHA256:uU2aco922hyEUXNi85CMlfdFyHf7tmeLcsZvly0KLuU.

RSA key fingerprint is MD5:68:a6:c9:60:a1:cb:12:e2:76:1a:ee:47:b0:8b:f9:ee.

Are you sure you want to continue connecting (yes/no)? yes

Check that the client version is appropriate for the server.

Warning: Interface definition mismatch for the following interface variables:

getfsnfshealthInd

gz3par cli% exit

再次执行:

ssh -Tq -i /root/gz3par 3paradm@3parip

直接进入无需输入密码。

验证通过。

  1. zabbix-agent设置定时捞取

crontab设置:

*/10 * * * * /etc/zabbix/scripts/3par/3par1sfp.sh > /etc/zabbix/scripts/3par/3par1sfp.log

3par1sfp.sh内容如下:

#!/bin/bash

loginuser="3paradm"

ipaddr="10.57.19.XX"

keyfile=/etc/zabbix/scripts/3par/gz3par.key

ssh -Tq -i $keyfile $loginuser@$ipaddr <<EOF

showport -sfp -ddm

exit

EOF

解释:

keyfile:为1.2步骤的/root/gz3par拷贝的私钥

showport -sfp -ddm:3par存储查看SFP光模块的收发光功率

  1. zabbix-agent自定义用户参数

vi /etc/zabbix/zabbix_agentd.conf

UserParameter=3par1_Fc1_txPower,cat /etc/zabbix/scripts/3par/3par1sfp.log | grep "TX Power"| sed -n '1p' | awk '{print $4}'

UserParameter=3par1_Fc2_txPower,cat /etc/zabbix/scripts/3par/3par1sfp.log | grep "TX Power"| sed -n '2p' | awk '{print $4}'

UserParameter=3par1_Fc5_txPower,cat /etc/zabbix/scripts/3par/3par1sfp.log | grep "TX Power"| sed -n '3p' | awk '{print $4}'

UserParameter=3par1_Fc6_txPower,cat /etc/zabbix/scripts/3par/3par1sfp.log | grep "TX Power"| sed -n '4p' | awk '{print $4}'

UserParameter=3par1_Fc7_txPower,cat /etc/zabbix/scripts/3par/3par1sfp.log | grep "TX Power"| sed -n '5p' | awk '{print $4}'

UserParameter=3par1_Fc8_txPower,cat /etc/zabbix/scripts/3par/3par1sfp.log | grep "TX Power"| sed -n '6p' | awk '{print $4}'

UserParameter=3par1_Fc11_txPower,cat /etc/zabbix/scripts/3par/3par1sfp.log | grep "TX Power"| sed -n '7p' | awk '{print $4}'

UserParameter=3par1_Fc12_txPower,cat /etc/zabbix/scripts/3par/3par1sfp.log | grep "TX Power"| sed -n '8p' | awk '{print $4}'

解释:此处定义了八个自定义参数,分别为每个port的TX功率值

重启zabbix-agent。

zabbix-server测试:

zabbix_get -s 10.57.17.107 -k "3par1_Fc12_txPower"

可以获取值,测试通过。

  1. zabbix-server设置监控项等

监控项:

触发器:

此处设置port tx power<400uW进行报警。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

半岛铁盒BKB

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值