Page 1 of 2
Memory Reporting
Posted: Tue Sep 09, 2014 2:13 pm
by greyclear
Trying to set this up
http://www.nsclient.org/nscp/wiki/CheckSystem/checkMem
This is my windows.cfg
Code: Select all
define service{
use generic-service
host_name STLSMS
service_description Memory Usage
check_command check_nrpe!checkMem
}
But how do I define the service?
I see it works from the command line
[root@nagios var]# /usr/lib64/nagios/plugins/check_nrpe -H stlsms -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
WARNING: physical memory: Total: 8G - Used: 7.01G (87%) - Free: 0.987G (13%) > warning|'physical memory %'=87%;80;90 'physical memory'=7.00999G;6;7;0;8
Re: Memory Reporting
Posted: Tue Sep 09, 2014 2:23 pm
by eloyd
I have to assume that your nrpe.cfg file is accepting arguments. Define your service as follows:
Code: Select all
define service{
use generic-service
host_name STLSMS
service_description Memory Usage
check_command check_nrpe!checkMem!MaxWarn=80% MaxCrit=90% ShowAll type=physical
}
Note that the arguments to an NRPE command are all sent as one argument through NRPE to the other side.
Re: Memory Reporting
Posted: Tue Sep 09, 2014 2:31 pm
by greyclear
Into what file does this go? This is the confusing part do I have to define each host/service for this? For example if I have 44 servers I am checking, that is 44 extra lines I will have to add to the templates.cfg or services.cfg
Re: Memory Reporting
Posted: Tue Sep 09, 2014 2:47 pm
by eloyd
The only difference between what I wrote and what you already have is the addition of the "!MaxWarn=80% MaxCrit=90% ShowAll type=physical" to the end of your command line in your windows.cfg file.
Yes, you need to add this to each host that you want to monitor this way, but it sounds like you might benefit from some basic Nagios training to get a feel for what files are used where. If that's the case, please look at
http://nagios.sourceforge.net/docs/3_0/quickstart.html and focus on the sections at the bottom called "
Monitoring Windows machines" and "
Monitoring Linux/Unix machines."
Re: Memory Reporting
Posted: Tue Sep 09, 2014 2:52 pm
by greyclear
Gotcha, I'm already part of the way in I just happened to notice that the memory checking was incorrect using check_nt command so I googled around and found this was more efficient. But when I added it like you stated and that is what I gathered from searching, I need to define it somewhere. Disregard the pervasive warning
Error: Service check command 'check_nrpe!checkMem!MaxWarn=80% MaxCrit=90% ShowAll type=physical' specified in service 'Memory Usage' for host 'STLSMS' not defined anywhere!
Code: Select all
[root@nagios var]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for service 'Pervasive' on host 'STLSMS' (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 147)
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Error: Service check command 'check_nrpe!checkMem!MaxWarn=80% MaxCrit=90% ShowAll type=physical' specified in service 'Memory Usage' for host 'STLSMS' not defined anywhere!
Checked 69 services.
Checked 10 hosts.
Checked 2 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 72 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 10 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 1
***> One or more problems was encountered while running the pre-flight check...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
Re: Memory Reporting
Posted: Tue Sep 09, 2014 2:55 pm
by eloyd
Put the stuff in quotes. If that doesn't fix it, we'll need to delve deeper into your configurations, and I'm about to head out for the day.
Code: Select all
check_command check_nrpe!checkMem!"MaxWarn=80% MaxCrit=90% ShowAll type=physical"
Re: Memory Reporting
Posted: Tue Sep 09, 2014 2:57 pm
by greyclear
Error: Service check command 'check_nrpe!checkMem!"MaxWarn=80% MaxCrit=90% ShowAll type=physical"' specified in service 'Memory Usage' for host 'STLSMS' not defined anywhere!
Re: Memory Reporting
Posted: Tue Sep 09, 2014 5:21 pm
by slansing
Can you show us the check_nrpe command you have defined in commands.cfg? Something may be getting caught up there.
Re: Memory Reporting
Posted: Wed Sep 10, 2014 7:54 am
by greyclear
I don't have any check_nrpe in my commands file
Re: Memory Reporting
Posted: Wed Sep 10, 2014 8:28 am
by eloyd
Well, there's your problem.
You need to define something in commands.cfg that looks like this:
Code: Select all
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a "$ARG2$"
}