Q&A for host/service/command best practices
Posted: Wed May 29, 2013 1:42 pm
I am new to Nagios by about 2 weeks. I read a lot of threads online and decided the only way I was going to know how to implement this in our environment was to get my hands dirty and likely have to re-visit how we implemented it after I know more.
So what I have done so far is, I have a cfg_dir defined where I store all my .cfg files.
Hosts/Groups are defined in one file. I have 150 hosts so far and many defined groups
Services are defined in another file.
Commands are defined in another file.
I re-use the same services for entire host groups. This seemed like a great idea initially, but what I have experienced is that the arguments I pass to the command via the service vary with many hosts.
Now I got to wondering would I be better off having a separate hostname.cfg and perhaps hostname-services.cfg and hostname-commands.cfg (basically hostname-{X}.cfg for the various needs I have)? I could easily create some template files and a shell script to on-board a new host. I just dont know if this is an approach that is used by others out there successfully? I also was thinking that I couldn't use the same service description as that must be unique. So that means likely thousands of services that are almost dupes except for the arguments I pass in that service are slightly different (ie: thresholds for warning vs critical are different for host-A vs host-B).
I was thinking I could almost re-use the same services and commands as I am doing now *IF* there was a way to define the arguments the service passes to the commands as variables, specified on the host level?
I know my concerns make sense in my head, but it is hard to convey to you guys. Hopefully some of this makes sense to you guys and hopefully you can help me understand how I can implement this with the most flexibility, ease of use, etc.
So what I have done so far is, I have a cfg_dir defined where I store all my .cfg files.
Hosts/Groups are defined in one file. I have 150 hosts so far and many defined groups
Services are defined in another file.
Commands are defined in another file.
I re-use the same services for entire host groups. This seemed like a great idea initially, but what I have experienced is that the arguments I pass to the command via the service vary with many hosts.
Now I got to wondering would I be better off having a separate hostname.cfg and perhaps hostname-services.cfg and hostname-commands.cfg (basically hostname-{X}.cfg for the various needs I have)? I could easily create some template files and a shell script to on-board a new host. I just dont know if this is an approach that is used by others out there successfully? I also was thinking that I couldn't use the same service description as that must be unique. So that means likely thousands of services that are almost dupes except for the arguments I pass in that service are slightly different (ie: thresholds for warning vs critical are different for host-A vs host-B).
I was thinking I could almost re-use the same services and commands as I am doing now *IF* there was a way to define the arguments the service passes to the commands as variables, specified on the host level?
I know my concerns make sense in my head, but it is hard to convey to you guys. Hopefully some of this makes sense to you guys and hopefully you can help me understand how I can implement this with the most flexibility, ease of use, etc.