仓储网站模板,网页设计的代码,建立网站主机,wordpress收录排名插件一.准备好被监控机器上面执行脚本,以备服务端发现和监控
脚本的内容:
ZABBI安装路径可执行文件及配置文件根据实际部署的路径更改
#!/bin/bash
/zabbixconfpath/zbx_nas.conf /zabbixscriptspath/findnas.sh /zabbixscriptspath/checknas.sh /zabbixscripts…一.准备好被监控机器上面执行脚本,以备服务端发现和监控
脚本的内容:
ZABBI安装路径可执行文件及配置文件根据实际部署的路径更改
#!/bin/bash
/zabbixconfpath/zbx_nas.conf /zabbixscriptspath/findnas.sh /zabbixscriptspath/checknas.sh /zabbixscriptspath/checknaswrite.sh
(
cat EOF
UserParameternas.discovery,/zabbixscriptspath/findnas.sh
UserParameternas.check[*],/zabbixscriptspath/checknas.sh \$1
UserParameternas.checkwrite[*],/zabbixscriptspath/checknaswrite.sh \$1
EOF
)/zabbixscriptspath/zbx_nas.conf(
cat EOF
#!/bin/bash
mount_discovery () {
mount | grep type nfs | grep -v nfsd | awk {print \$3} /zabbixscriptspath/naslists.txt
chown zabbixuser:zabbixuser /zabbixscriptspath/naslists.txt
NAS_LIST(\$(cat /zabbixscriptspath/naslists.txt)) printf {\n printf \tdata:[\n
for((i0;i\${#NAS_LIST[]};i))
{
num\$(echo \$((\${#NAS_LIST[]}-1))) if [ \$i ! \${num} ]; then printf \t\t{ \n printf \t\t\t\{#NASNAME}\:\\${NAS_LIST[\$i]}\},\n else printf \t\t{ \n printf \t\t\t\{#NASNAME}\:\\${NAS_LIST[\$num]}\}]}\n fi
}
}
mount_discovery
EOF
)/zabbixscriptspath/findnas.sh(
cat EOF
#!/bin/bashtimeout 3 df -h \$1 /dev/null
if [ \$? -ne 0 ]; thenecho 1
elseecho 0
fiEOF
)/zabbixscriptspath/checknas.sh(
cat EOF
#!/bin/bashtimeout 3 touch \$1/zabbixtestfiles.txt.txt.txt /dev/null
if [ \$? -ne 0 ]; thenecho 1
elseecho 0
fi
EOF
)/zabbixscriptspath/checknaswrite.shchmod ax /zabbixscriptspath/findnas.sh /zabbixscriptspath/checknas.sh /zabbixscriptspath/checknaswrite.sh
systemctl restart zabbix-agent.service || ps -ef | grep zabbix-agent | grep -v grep | awk {print $2} | xargs -I {} kill {};sleep 1;su - zabbixuser -c /zabbixpath/sbin/zabbix_agentd -c /zabbixpath/conf/zabbix_agentd.conf二.ZABBIX监控模板导出的XML文件如下:
?xml version1.0 encodingUTF-8?
zabbix_exportversion6.0/versiondate2023-08-14T06:54:29Z/dategroupsgroupuuid7df96b18c230490a9a0a9e2307226338/uuidnameTemplates/name/group/groupstemplatestemplateuuidd506374c76194ef2a89f16a5a1a2bdd0/uuidtemplatezabbixtest-Template-naschk/templatenamezabbix-Template-naschk/namegroupsgroupnameTemplates/name/group/groupsdiscovery_rulesdiscovery_ruleuuid65640ddbe5274e79966964e0acdbc503/uuidnamefindnas/namekeynas.discovery/keydelay60m/delayitem_prototypesitem_prototypeuuid98d3e0de995246b8ab905e11c39c774d/uuidnamechknas write on {#NASNAME}/namekeynas.checkwrite[{#NASNAME}]/keydelay60m/delaytrigger_prototypestrigger_prototypeuuidbc3fd41f548f4c93b697d01d1af5c3d8/uuidexpressionlast(/zabbixtest-Template-naschk/nas.checkwrite[{#NASNAME}])lt;gt;0/expressionnameNAS盘write{#NASNAME}状态异常/nameevent_nameNAS盘write{#NASNAME}状态异常/event_namestatusDISABLED/statuspriorityHIGH/priority/trigger_prototype/trigger_prototypes/item_prototypeitem_prototypeuuid0c70897bc30446c5a07c1ecaa863c11d/uuid
三.导入模板,在被监控的主机上执行脚本和应用监控模板,实现对被监控主机NAS盘读写情况的监控
并根据实际的需求启用/禁用触发器