Not supported by default
I would like to send a ping from the monitored host
I built a Linux-based VPN router strongSwan, but when I set up a VPN between routers with ipsec, I want to monitor ping from strongSwan to monitor communication to the address when NAT is applied on the remote router side.
simple check – icmpping and agent.ping
As you can see from the simple check, it is a monitoring that does not involve zabbix-agent.
The ping source will be the ZABBIX server and will send the ping.
If you set only icmpping as the key when setting the item, it will be monitored for the host that set the item.
If you set it like icmpping[184.108.40.206], it will monitor ping from ZABBIX server to 220.127.116.11, and the result will be displayed in the latest data of the host where the item is set.
Of course, the communication destination of the VPN cannot be seen from the ZABBIX server, so it cannot be pinged directly.
agent.ping is a way to monitor the presence or absence of a response from zabbix-agent without using ICMP.
Check ping behavior
If 1 is specified in the c option, ping will be sent only once.
Set the timeout to 1 second with the w option.
Redirect standard output and errors to /dev/null and throw them away. (no output)
Connect to the next command with a semicolon and output the return value of ping with echo $?. Returns 0 for ping response, 2 for no response.
Set to UserParameter
Set it in zabbix_agentd.conf of the host you want to ping from, and then restart the agent.
Check with zabbix_get
made new UserParameter named remote.ping and test it from monitored host.
sample as above, using userparameter “remote.ping” and test ping to 18.104.22.168 from monitored host.
result is 0. it mean ping reachable.
Add item to host
Name：ping test from remote
Type of information：Numeric(unsigned)
test for ping to 22.214.171.124
Confirm with tcpdump
Certainly, you can see ping from the monitoring host to 126.96.36.199.
Set for value of mapping
set for value 0 as up. and value 1 as down.
set value mapping to item.
You can see result is as Up (0)
set for if value will become 1, it will be trigger.
test for trigger
change ping target to unreachable destination for test.
it will display as ping down on Dashboard.
I think there is a demand for ping monitoring from monitoring to another target.
It is strange why it is not implemented by default.
But you can easily implement it using UserParameter.
This time, we have actually monitored Strongswan with LLD (low level discovery) and automatically add the IPsec communication destination to ping monitoring.
Even if the connection destination of the router VPN increases, it will automatically add to the ping monitoring.
Let’s enhance the monitoring.