.. | ||
network_availability_by_zabbix_agent.yaml | ||
README.md |
Network availability by Zabbix agent
Overview
This template is designed for network availability monitoring by Zabbix via ping and doesn't require any external scripts.
Requirements
- Zabbix version: 6.0 and higher.
Define user parameters.
Tested versions
This template has been tested on:
Macros used
Name | Description | Default |
---|---|---|
{$ADDRESS1} | address to check availability | 1.1.1.1 |
{$ADDRESS2} | address to check availability | 8.8.8.8 |
{$ADDRESS3} | address to check availability | 9.9.9.9 |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
Network address 1 available | Availability of address 1 by ping | Zabbix agent | 'network.address1[{$ADDRESS1}]' |
Network address 2 available | Availability of address 2 by ping | Zabbix agent | 'network.address2[{$ADDRESS2}]' |
Network address 3 available | Availability of address 3 by ping | Zabbix agent | 'network.address3[{$ADDRESS3}]' |
Network default gateway | Network default gateway | Zabbix agent | 'network.gateway' |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
Network via {ITEM.VALUE4} not available | last(/Network availability by Zabbix agent/network.address1[{$ADDRESS1}],#1)=0 and last(/Network availability by Zabbix agent/network.address2[{$ADDRESS2}],#1)=0 and last(/Network availability by Zabbix agent/network.address3[{$ADDRESS3}],#1)=0 and length(last(/Network availability by Zabbix agent/network.gateway))>0)<7 | High | Manual close: No | |
Default gateway has changed (new gateway: {ITEM.VALUE}) | last(/Network availability by Zabbix agent/network.gateway,#1)<>last(/Network availability by Zabbix agent/network.gateway,#2) and length(last(/Network availability by Zabbix agent/network.gateway))>0 | Average | Manual close: Yes |
Discovery rules
There are no discovery rules in this template.
Item prototypes for Clients discovery
There are no item prototypes in this template.
Define user parameters
for Linux:
tee -a /etc/zabbix/zabbix_agentd.conf > /dev/null <<'EOF'
Timeout=30
UserParameter=network.gateway, ip ro | grep -e default | awk '{print $3}'
UserParameter=network.address1[*], ping -q -w 3 -c 1 $1 > /dev/null && echo 1 || echo 0
UserParameter=network.address2[*], ping -q -w 3 -c 1 $1 > /dev/null && echo 1 || echo 0
UserParameter=network.address3[*], ping -q -w 3 -c 1 $1 > /dev/null && echo 1 || echo 0
EOF
systemctl restart zabbix-agent
for Windows:
powershell.exe
$text = @"
Timeout=30
UserParameter=network.gateway, powershell.exe -Command "Get-NetRoute -DestinationPrefix '0.0.0.0/0' | Select-Object -ExpandProperty 'NextHop'"
UserParameter=network.address1[*], ping -w 3000 -n 1 $1 > NUL && echo 1 || echo 0
UserParameter=network.address2[*], ping -w 3000 -n 1 $1 > NUL && echo 1 || echo 0
UserParameter=network.address3[*], ping -w 3000 -n 1 $1 > NUL && echo 1 || echo 0
"@
$text | Out-File -Append "$env:ProgramFiles\Zabbix Agent\zabbix_agentd.conf" -Encoding "UTF8"
exit
sc stop "Zabbix Agent" && sc start "Zabbix Agent"