Monitor CPU utilization using NAGIOS

HI

How we can monitor CPU utilization using NAGIOS

@balajitk88
Just add the following check_command service to your host section of services.cfg file and don’t forget change host_name parameter in below code with your host hostname.

define service { use generic-service host_name tecmint service_description CPU Load check_command check_nrpe!check_load }
For more detailed instructions on how to add remote Linux host and services, visit: http://www.tecmint.com/how-to-add-linux-host-to-nagios-monitoring-server/

@balajitk88 : I agree with ravisaive. It worked for me. According to my knowledge tecmint is best site for nagios reference.

1 Like

HI Ravi

Thanks for your reply. I am going to monitor CPU utilization to my localhost. As per your instruction i have added check_load i am receiving the error. Below is the screen shot please check it.

Please let us know how to rectify this issue

1 Like

@iamarunk1898

Can you please share your configuration with me? so that I can give you proper solution…

HI

Please find the attachment of my command.cfg and localhost.cfg file


Since configuration file is not allowing me to upload. i have uploaded the screen shot Pls check

@balajitk88

No you don’t need to add anything to localhost.cfg file as it comes pre-defined configuration checks. Can you please verify the Nagios configuration with this command and post the output here.

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

I have run the command below is the screenshot

@balajitk88
On Nagios monitoring server from the terminal can you run the following command and post the output here?

# /usr/local/nagios/libexec/check_load -h localhost -w 15,10,5 -c 30,25,20

Please find the screen shot below

Run the whole following command in one liner.

# /usr/local/nagios/libexec/check_load -h localhost -w 15,10,5 -c 30,25,20
OR
# /usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20

I have typed the command in one line still same error

@balajitk88

Can I have access to your server via Teamviewer? so that I can check and resolve it. Don’t worry about the credentials you can change later on after fixing the issue…

1 Like

Please give some time. Let me tell . Actually remote login is security thread in our company

HI

shall i tell my team viewer id to access my system

I am using the plugin check_cpu. My services.cfg file looks below

When i seeing the nagios dashboard i am getting staus information missing host. Below is the screen shot pls check

1 Like

HI

I am using the below script to monitor CPU but its showing always critical even though my cpu is less. Please let us know what to do

#!/bin/bash
CURR_LOAD=100;
if [ $CURR_LOAD -le 50 ]
then
echo “OK : Load is under threshold”
exit 0;
elif [ $CURR_LOAD -le 80 -a $CURR_LOAD -ge 90 ]
then
echo “WARN : Load on xyz host is $CURR_LOAD”
exit 1;
elif [ $CURR_LOAD -gt 90 ]
then
echo “CRITICAL : Load on xyz host is CRITICAL i.e. $CURR_LOAD”
exit 2;

1 Like