Memory Reporting

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
greyclear
Posts: 27
Joined: Tue Sep 09, 2014 7:50 am

Memory Reporting

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

Re: Memory Reporting

Post 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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
greyclear
Posts: 27
Joined: Tue Sep 09, 2014 7:50 am

Re: Memory Reporting

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

Re: Memory Reporting

Post 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."
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
greyclear
Posts: 27
Joined: Tue Sep 09, 2014 7:50 am

Re: Memory Reporting

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

Re: Memory Reporting

Post 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"
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
greyclear
Posts: 27
Joined: Tue Sep 09, 2014 7:50 am

Re: Memory Reporting

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

Re: Memory Reporting

Post by slansing »

Can you show us the check_nrpe command you have defined in commands.cfg? Something may be getting caught up there.
greyclear
Posts: 27
Joined: Tue Sep 09, 2014 7:50 am

Re: Memory Reporting

Post by greyclear »

I don't have any check_nrpe in my commands file
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Memory Reporting

Post 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$"
}
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Locked