added 'Network availabilty by Zabbix agent'
This commit is contained in:
parent
e9aaf4bbf6
commit
9f7232e433
|
@ -11,6 +11,7 @@ Templates, scripts and hints for Zabbix.
|
|||
* [Wireguard](templates/applications/vpn/wireguard/6.0)
|
||||
* [Components](templates/components)
|
||||
* [certificate](templates/components/certificate/6.0)
|
||||
* [network availability](templates/components/network-availability/6.0)
|
||||
* [Sensors](templates/sensors)
|
||||
* [ds18b20](templates/sensors/ds18b20/6.0)
|
||||
* [Media](templates/media)
|
||||
|
|
83
templates/components/network-avalability/6.0/README.md
Executable file
83
templates/components/network-avalability/6.0/README.md
Executable file
|
@ -0,0 +1,83 @@
|
|||
|
||||
# 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.`](https://git.hmp.today/pavel.muhortov/zabbix/templates/components/network-availability/6.0#define-user-parameters)
|
||||
|
||||
## Tested versions
|
||||
|
||||
This template has been tested on:
|
||||
|
||||
- [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/)
|
||||
- [Windows 11](https://www.microsoft.com/en-us/windows/windows-11)
|
||||
|
||||
### 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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```batch
|
||||
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"
|
||||
```
|
|
@ -0,0 +1,102 @@
|
|||
zabbix_export:
|
||||
version: '6.0'
|
||||
date: '2024-05-27T00:00:00Z'
|
||||
groups:
|
||||
-
|
||||
uuid: 57b7ae836ca64446ba2c296389c009b7
|
||||
name: Templates/Modules
|
||||
templates:
|
||||
-
|
||||
uuid: 31538ea897534700a46e0008d4d835c7
|
||||
template: 'Network availability by Zabbix agent'
|
||||
name: 'Network availability by Zabbix agent'
|
||||
groups:
|
||||
-
|
||||
name: Templates/Modules
|
||||
items:
|
||||
-
|
||||
uuid: 7f009a445d3c4817801e98385f29350a
|
||||
name: 'Network address 1 available'
|
||||
key: 'network.address1[{$ADDRESS1}]'
|
||||
tags:
|
||||
-
|
||||
tag: component
|
||||
value: network
|
||||
-
|
||||
uuid: ac56b7e0a0da4ac280c3733e6781d5db
|
||||
name: 'Network address 2 available'
|
||||
key: 'network.address2[{$ADDRESS2}]'
|
||||
tags:
|
||||
-
|
||||
tag: component
|
||||
value: network
|
||||
-
|
||||
uuid: 499612f471b841fe854afeeb21602736
|
||||
name: 'Network address 3 available'
|
||||
key: 'network.address3[{$ADDRESS3}]'
|
||||
tags:
|
||||
-
|
||||
tag: component
|
||||
value: network
|
||||
-
|
||||
uuid: 340ba36bccb04048b77235ce29eb162a
|
||||
name: 'Network default gateway'
|
||||
key: network.gateway
|
||||
trends: '0'
|
||||
value_type: TEXT
|
||||
tags:
|
||||
-
|
||||
tag: component
|
||||
value: network
|
||||
triggers:
|
||||
-
|
||||
uuid: 67fdd285791844d5be615d332976e9bb
|
||||
expression: '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'
|
||||
name: 'Default gateway has changed (new gateway: {ITEM.VALUE})'
|
||||
priority: AVERAGE
|
||||
description: 'Default gateway has changed. Ack to close.'
|
||||
manual_close: 'YES'
|
||||
macros:
|
||||
-
|
||||
macro: '{$ADDRESS1}'
|
||||
value: 1.1.1.1
|
||||
-
|
||||
macro: '{$ADDRESS2}'
|
||||
value: 8.8.8.8
|
||||
-
|
||||
macro: '{$ADDRESS3}'
|
||||
value: 9.9.9.9
|
||||
triggers:
|
||||
-
|
||||
uuid: d6b05398385241e3b023277a16c8c611
|
||||
expression: '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'
|
||||
name: 'Network via {ITEM.VALUE4} not available'
|
||||
opdata: '{$ADDRESS1}, {$ADDRESS2}, {$ADDRESS3}'
|
||||
priority: HIGH
|
||||
graphs:
|
||||
-
|
||||
uuid: 2a984d60fe25442687af8a0e6973eeac
|
||||
name: 'Network addresses available'
|
||||
show_triggers: 'NO'
|
||||
ymin_type_1: FIXED
|
||||
graph_items:
|
||||
-
|
||||
drawtype: GRADIENT_LINE
|
||||
color: FF0000
|
||||
item:
|
||||
host: 'Network availability by Zabbix agent'
|
||||
key: 'network.address1[{$ADDRESS1}]'
|
||||
-
|
||||
sortorder: '1'
|
||||
drawtype: GRADIENT_LINE
|
||||
color: FFFF00
|
||||
item:
|
||||
host: 'Network availability by Zabbix agent'
|
||||
key: 'network.address2[{$ADDRESS2}]'
|
||||
-
|
||||
sortorder: '2'
|
||||
drawtype: GRADIENT_LINE
|
||||
color: 00FF00
|
||||
item:
|
||||
host: 'Network availability by Zabbix agent'
|
||||
key: 'network.address3[{$ADDRESS3}]'
|
Loading…
Reference in New Issue
Block a user