Add service check via command line

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sureshkraj2012
Posts: 65
Joined: Tue Aug 06, 2013 11:06 pm

Add service check via command line

Post 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.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Add service check via command line

Post 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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Add service check via command line

Post by scottwilkerson »

Or you can use the process outlined in this document to create hosts/services
http://assets.nagios.com/downloads/nagi ... gement.pdf
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
technick
Posts: 49
Joined: Tue Feb 04, 2014 10:30 am
Location: Denver, CO

Re: Add service check via command line

Post 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
----------------------
Nagios Jedi in training.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Add service check via command line

Post 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...
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sureshkraj2012
Posts: 65
Joined: Tue Aug 06, 2013 11:06 pm

Re: Add service check via command line

Post 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?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Add service check via command line

Post 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/
Locked