Windows.cfg

Hi everyone newbie here. I have set up Nagios and one agent on a windows server for testing to see how everything works. I ve finally got my e-mail notifications working with help from this forum.

My question is I want to start deploying agents on other servers, do I need to make a new windows.cfg file for each one. Example Server1 server1.cfg, Server2 server2.cfg Or do I just keep adding to the original windows.cfg

Example:

Create a service for monitoring the uptime of the server

Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name Server1
service_description Uptime
check_command check_nt!UPTIME
}

Create a service for monitoring the uptime of the server

Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name Server2
service_description Uptime
check_command check_nt!UPTIME
}

Create a service for monitoring CPU load

Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name Server1
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}

Create a service for monitoring CPU load

Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name Server2
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}

Ok I figured it out.

Can you tell me how you figured it out? I have the EXACT same question myself.

Thanks!

Generally I would suggest you add them to the same file, but in some cases you may want to make additional files. As you add more and more to nagios you may find one file a little unruly. I have a few config file for organization purposes. Since I have so many servers to monitor I use a seperate config file for each hostgroup. But if you only have a few servers stick to one. I just found 150+ servers and anywhere from 1 to 20 services per server to be too much for one file.

In short nagios doesn’t care so do whatever you and your colleagues find easiest to manage.

[quote=“lokiz”]Generally I would suggest you add them to the same file, but in some cases you may want to make additional files. As you add more and more to nagios you may find one file a little unruly. I have a few config file for organization purposes. Since I have so many servers to monitor I use a seperate config file for each hostgroup. But if you only have a few servers stick to one. I just found 150+ servers and anywhere from 1 to 20 services per server to be too much for one file.

In short nagios doesn’t care so do whatever you and your colleagues find easiest to manage.[/quote]

Thanks for the advice. I guess I’m looking more for an explanation of *how *to use multiple files. Or more specifically, how to format the files.

I actually made a little progress with it last night. I created a new file in /usr/local/nagios/etc/objects/ called hosts.cfg that contains two hosts and two services. I pointed my nagios.cfg file to the hosts.cfg file. My hosts.cfg file looks like this:

I’d suggest using templates. All the things you keep the same you can just put into a template and then use that. Such as check periods etc. There should have been some default ones in a file called templates.cfg. You can even use templates to create other templates. Templates are just the same as host or service definitions except you add the line:

which tells nagios that it is a template.

There is a lot better documentation on templates out there than I can give you.

Beyond that what you are doing is fine. I like to comment a bit more. Mainly the division between host definitions and service definitions. But that is because I was educated as a coder so commenting was drilled into me, plus it makes it easier when scrolling through long files to find the section I need.

I am still learning myself. Actually working on getting nagios-wsc (http://nagios-wsc.sourceforge.net/) working myself. So just keep at it, keep refining your methods. Just make sure anyone else can follow what you are doing.

Thanks for the help. I’m not a programmer so I’m sure that’s part of my confusion with a lot of this.

Have you done anything with the NSCA daemon & client? I’m trying to get my Windows 2000 servers to send Event Log data to Nagios withe NSCA, but I’m getting stuck there too. I followed the setup guide, but it only gives an example of how to do tests from the local host.