Page 1 of 1

Add service check via command line

Posted: Fri Jun 06, 2014 1:31 am
by sureshkraj2012
Hello,

Is there a way to add service check through command line in NagiosXI?

Need to add below service check in around 300 servers and it is little hard to do through GUI.

COMMAND: /usr/local/nagios/libexec/check_nrpe -H xxxx.domain.com -t 30 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll=long type=physical

Any help on this would be much appreciated.

Re: Add service check via command line

Posted: Fri Jun 06, 2014 7:29 am
by eloyd
I'm not sure if this is what you're looking for, but you can create a configuration file that contains whatever you need and move it to /usr/local/nagiosxi/import then:

Code: Select all

cd /usr/local/nagiosxi/scripts
sh reconfigure_nagios.sh
Nagios will import that into the XI configuration.

Re: Add service check via command line

Posted: Fri Jun 06, 2014 10:52 am
by scottwilkerson
Or you can use the process outlined in this document to create hosts/services
http://assets.nagios.com/downloads/nagi ... gement.pdf

Re: Add service check via command line

Posted: Wed Jun 11, 2014 11:41 am
by technick
sureshkraj2012 wrote:Hello,

Is there a way to add service check through command line in NagiosXI?

Need to add below service check in around 300 servers and it is little hard to do through GUI.

COMMAND: /usr/local/nagios/libexec/check_nrpe -H xxxx.domain.com -t 30 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll=long type=physical

Any help on this would be much appreciated.
If I am reading this correctly... These solutions would work

1. Create a hostgroup with the 300 servers and then associate your service check to the hostgroup. {recommended}
2. Create flat files for these configurations and store them in /usr/local/nagios/etc/static
3. Create flat files and import everything over using the above methodology.

I'm a big proponent of keeping things simple which is why I would go with option 1 personally.

Cheers

Re: Add service check via command line

Posted: Wed Jun 11, 2014 12:56 pm
by scottwilkerson
technick wrote:If I am reading this correctly... These solutions would work

1. Create a hostgroup with the 300 servers and then associate your service check to the hostgroup. {recommended}
2. Create flat files for these configurations and store them in /usr/local/nagios/etc/static
3. Create flat files and import everything over using the above methodology.

I'm a big proponent of keeping things simple which is why I would go with option 1 personally.

Cheers
Correct.

Then anytime you add a host to the hostgroup they will automatically get all the services that have this hostgroup associated.

This is really the ideal setup if you always monitor the same items on a group of servers and they all have the same settings (thresholds, etc).

this is something to think about, because changing the warning/critical threshold on the service definition, will change it for ALL of the hosts. In many cases this is desirable, in some it is not...

Re: Add service check via command line

Posted: Thu Jun 12, 2014 10:51 am
by sureshkraj2012
Thank you for your valuable solutions!
I would like to append this (checkMEM) service check via command line along with other service check (CPU, disk etc..,) that are already configured.

/usr/local/nagios/libexec/check_nrpe -H xxxx.domain.com -t 30 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll=long type=physical

Also, could you please elaborate on flat file and it would be great if example provided?

Re: Add service check via command line

Posted: Thu Jun 12, 2014 10:56 am
by slansing
Creation and use of the static flat config files in XI is covered here:

http://assets.nagios.com/downloads/nagi ... _Files.pdf

For some examples please take a look at the "How to monitor" sections here:

http://nagios.sourceforge.net/docs/3_0/toc.html

You can also see all of the flat config file versions of what you have in your XI server's database for hosts and services in:

Code: Select all

/usr/local/nagios/etc/hosts/
/usr/local/nagios/etc/services/