I think I know the answer to this already.....I just hope I'm wrong.
I am monitoring close to 200 hosts with Nagios..... depending on the system, a check that I do for every system may be different.
for example..... for some systems, a ping check needs to fail 5 times before alerting, on others, ping can fail 10 times, others, it will start alerting at 1 fail, etc, etc, etc.....
I really don't want to create seperate ping checks for each host......
(btw...using ping is just an example, but you get the idea.)
(on a side note, for my host alive....i check the WMI service instead of ping)
Same check, different parameters
Same check, different parameters
Everybody is somebody else’s weirdo
Re: Same check, different parameters
Try defining each host with a custom object macro (http://nagios.sourceforge.net/docs/3_0/ ... tvars.html) and you can then use that in the service definition to change the threshold based on the host.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Same check, different parameters
Wouldn't that pretty much as creating a separate service definition for each one?
For example
Host1…… ping checks every 5 min, c drive check at 5 min, warn at 80%
Host2…. Ping checks every 1 min, c drive check at 1 min, warn at 90%
From what I understand, I need to make a service that defines ping for 5 min, a service that checks the c drive at 5 min, and the warning at 80%, a service that checks ping at 1 min, and another one for c drive every min and warn at 90%
I don’t see how the custom object macro’s are any different.
For example
Host1…… ping checks every 5 min, c drive check at 5 min, warn at 80%
Host2…. Ping checks every 1 min, c drive check at 1 min, warn at 90%
From what I understand, I need to make a service that defines ping for 5 min, a service that checks the c drive at 5 min, and the warning at 80%, a service that checks ping at 1 min, and another one for c drive every min and warn at 90%
I don’t see how the custom object macro’s are any different.
Everybody is somebody else’s weirdo
Re: Same check, different parameters
This may not specifically apply to you, but I offer it as a suggestion. So here's one way it might work:
(Note, these examples are Nagios "pseudo-code" style configs, not real configuration examples)
define hostgroup {
hostgroup_name ping_hosts
members host1, host2
}
define hostgroup {
hostgroup_name drive_hosts
members host2
}
[/code]
This VERY NOT LEGAL CONFIGURATION example would make two hosts, assign one the the "ping_hosts" group and the second to the "ping_hosts" and "drive_hosts" group, create a service for ping and check_drive that are assigned to their respective groups, and use macros to determine how often things get pinged and what the values are for warning thresholds.
Edit: So no, you do not have to create a separate service for each one. What you DO have to do, though, is make sure you define the MACROS for each host that you will use in the service definitions. Much easier, overall. And once you start using hostgroups to determine what services run on which servers, you greatly simplify things as well.
(Note, these examples are Nagios "pseudo-code" style configs, not real configuration examples)
Code: Select all
define host {
hostname x.domain.com
_PING_EVERY 5
_DRIVE_EVERY 5
_DRIVE_WARN 80%
hostgroup ping_hosts
}
define host {
hostname y.domain.com
_PING_EVERY 1
_DRIVE_EVERY 1
_DRIVE_WARN 90%
hostgroup ping_hosts, drive_hosts
}
define service {
service_name check_ping
check_interval $_HOSTPING_EVERY
hostgroups ping_hosts
}
define service {
service_name check_disk
check_interval $_HOSTDRIVE_EVERY
check_command check_disk!$_HOSTDRIVE_WARN
hostgroups drive_hosts
}
define command {
command_name check_disk
command $USER1$/libexec/check_disk <parameters> -w $ARG1$
}
hostgroup_name ping_hosts
members host1, host2
}
define hostgroup {
hostgroup_name drive_hosts
members host2
}
[/code]
This VERY NOT LEGAL CONFIGURATION example would make two hosts, assign one the the "ping_hosts" group and the second to the "ping_hosts" and "drive_hosts" group, create a service for ping and check_drive that are assigned to their respective groups, and use macros to determine how often things get pinged and what the values are for warning thresholds.
Edit: So no, you do not have to create a separate service for each one. What you DO have to do, though, is make sure you define the MACROS for each host that you will use in the service definitions. Much easier, overall. And once you start using hostgroups to determine what services run on which servers, you greatly simplify things as well.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Same check, different parameters
I do use host groups, and have tried to group similar checks to be asigned to the hosts that they would apply to.
Thank you for your assistance.
Thank you for your assistance.
Everybody is somebody else’s weirdo
Re: Same check, different parameters
You are welcome. Custom macros can be very powerful for doing different things for different hosts without the need for different service definitions.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Same check, different parameters
I'm sure they are...... I am just not getting the concept of how they are different.
I might just need to think it through more.
I might just need to think it through more.
Everybody is somebody else’s weirdo
Re: Same check, different parameters
Let me know if I can be of any further assistance. Perhaps with actual, real-world examples for you.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Same check, different parameters
JohnFLi, are we clear to lock this thread up?
Former Nagios employee
Re: Same check, different parameters
Yes, please close this
thank you
thank you
Everybody is somebody else’s weirdo