Multiple IP address check on same host

I know I have seen the solution to my problem somewhere but I can no longer find it.

I have 3 IP addresses on one server and I wish to essentially do what hostalive does for all 3 addresses. Can anyone point me to the solution or give me some hints?

chek_icmp can ping multiple IPs and you can define how many should be reachable:

Another possibility is check_multi:

2 Likes

Hi folks!

just created an simple service to check IPSec via icmp and stuck with director how to put multiple addresses to custom field

as i understood array is no problem

https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#icmp

tried with space without luck

command works fine without apostrophe, for example (IP’s changed!)
with apastrophe coming via director icmp wont randomize, takes only first address

'/usr/lib/nagios/plugins/check_icmp' '-c' '200,15%' '-w' '100,5%' '-H' 10.0.1.1 10.0.1.2 -v
ttl set to 64
Setting alarm timeout to 10 seconds
packets: 5, targets: 2
target_interval: 0,000, pkt_interval 80,000
crit.rta: 200,000
max_completion_time: 3000,000
crit = {200000, 15%}, warn = {100000, 5%}
pkt_interval: 80000  target_interval: 0  retry_interval: 0
icmp_pkt_size: 76  timeout: 10
18,014 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 18,014, min: 18,014
18,070 ms rtt from 10.0.1.2, outgoing ttl: 64, incoming ttl: 121, max: 18,070, min: 18,070
17,228 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 18,014, min: 17,228
17,239 ms rtt from 10.0.1.2, outgoing ttl: 64, incoming ttl: 121, max: 18,070, min: 17,239
17,304 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 18,014, min: 17,228
17,522 ms rtt from 10.0.1.2, outgoing ttl: 64, incoming ttl: 121, max: 18,070, min: 17,239
17,065 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 18,014, min: 17,065
17,083 ms rtt from 10.0.1.2, outgoing ttl: 64, incoming ttl: 121, max: 18,070, min: 17,083
17,232 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 18,014, min: 17,065
17,258 ms rtt from 10.0.1.2, outgoing ttl: 64, incoming ttl: 121, max: 18,070, min: 17,083
icmp_sent: 10  icmp_recv: 10  icmp_lost: 0
targets: 2  targets_alive: 2
OK - 
10.0.1.1: rta 17,369ms, lost 0%
 :: 10.0.1.2: rta 17,434ms, lost 0%|
10.0.1.1rta=17,369ms;100,000;200,000;0; 10.0.1.1pl=0%;5;15;; 10.0.1.1rtmax=18,014ms;;;; 10.0.1.1rtmin=17,065ms;;;; 
10.0.1.2rta=17,434ms;100,000;200,000;0; 10.0.1.2pl=0%;5;15;; 10.0.1.2rtmax=18,070ms;;;; 10.0.1.2rtmin=17,083ms;;;; 
targets: 2, targets_alive: 2, hosts_ok: 2, hosts_warn: 0, min_hosts_alive: -1

 '/usr/lib/nagios/plugins/check_icmp' '-c' '200,15%' '-w' '100,5%' '-H' '10.0.1.1 10.0.1.2' -v
ttl set to 64
Setting alarm timeout to 10 seconds
packets: 5, targets: 1
target_interval: 0,000, pkt_interval 80,000
crit.rta: 200,000
max_completion_time: 1600,000
crit = {200000, 15%}, warn = {100000, 5%}
pkt_interval: 80000  target_interval: 0  retry_interval: 0
icmp_pkt_size: 76  timeout: 10
17,427 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 17,427, min: 17,427
17,192 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 17,427, min: 17,192
16,985 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 17,427, min: 16,985
16,826 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 17,427, min: 16,826
16,951 ms rtt from 10.0.1.1, outgoing ttl: 64, incoming ttl: 121, max: 17,427, min: 16,826
icmp_sent: 5  icmp_recv: 5  icmp_lost: 0
targets: 1  targets_alive: 1
OK - 
10.0.1.1 10.0.1.2: rta 17,076ms, lost 0%|
rta=17,076ms;100,000;200,000;0; pl=0%;5;15;; rtmax=17,427ms;;;; rtmin=16,826ms;;;; 
targets: 1, targets_alive: 1, hosts_ok: 1, hosts_warn: 0, min_hosts_alive: -1

solved by define field icmp_address as Array instead of String
now we can define multiple addresses via GUI as expected and it works



Selection_022