Monitoring NCPA

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Monitoring NCPA

Postby Ibouguerra » Thu Jul 05, 2018 9:51 am

Hi everyone,

I learn how to use nagios and i'm actually trying to monitor a host with the NCPA agent, but i didn't really understand what's happened.
Then, i first install the NCPA agent on my nagios core server (i dont know if it's a good idea to try to monitor the master). I succeed and I connected to the GUI.
Now i want to monitor the host with nagios, and i follow this guide : https://www.nagios.org/ncpa/getting-started.php#linux
I download the check_ncpa.py into usr/local/nagios/libexec. I create a check_ncpa command into the usr/local/nagios/etc/objects/commands.cfg file like this :
Code: Select all
###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.4.1
#
#
# NOTES: This config file provides you with some example command definitions
#        that you can reference in host, service, and contact definitions.
#
#        You don't need to keep commands in a separate file from your other
#        object definitions.  This has been done just to make things easier to
#        understand.
#
###############################################################################

define command {
    command_name    check_ncpa
    command_line    $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}

################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands.  They may or may not work on
# your system without modification.  As an example, some systems will require
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################

define command {

    command_name    notify-host-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

...


After that i create ncpa.cfg file into the usr/local/nagios/etc/objects directory like this :
Code: Select all
define host {
    host_name               nagioscore
    address                 xxx.xxx.xxx.xxx
    check_command           check_ncpa!-t mytoken -P 5693 -M system/agent_version
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    contacts                nagiosadmin
    notification_interval   60
    notification_period     24x7
    notifications_enabled   1
    icon_image              ncpa.png
    statusmap_image         ncpa.png
    register                1
}

define service {
    host_name               nagioscore
    service_description     CPU Usage
    check_command           check_ncpa!-t mytoken -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmin
    register                1
}

define service {
    host_name               nagioscore
    service_description     Memory Usage
    check_command           check_ncpa!-t mytoken -P 5693 -M memory/virtual -w 50 -c 80 -u G
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmin
    register                1
}

define service {
    host_name               nagioscore
    service_description     Process Count
    check_command           check_ncpa!-t mytoken -P 5693 -M processes -w 150 -c 200
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmin
    register                1
}


Then i restarted nagios services. Now i dont know how to test if it works, i tried to verify in the web interface of nagios if i saw other services, but i actually just see the main services as if i never installed the ncpa agent, just nagios core and the plugins.

I'm sorry if i'm not clear at all, and thank you in advance for your help
Ibouguerra
 
Posts: 5
Joined: Tue Jul 03, 2018 7:48 am

Re: Monitoring NCPA

Postby lmiltchev » Thu Jul 05, 2018 11:03 am

Are you installing the NCPA agent and the check_ncpa.py plugin on the same machine? You need to have the plugin installed on the Nagios Core box (in the libexec directory), but the agent needs to be installed on the remote machine...

What is the OS/architecture of the remote machine?

Can you run the following command from the command line on the Nagios Core box, and show the output?

Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H <remote ip> -t '<token>' -P 5693 -M 'system/agent_version'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 10722
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring NCPA

Postby Ibouguerra » Fri Jul 06, 2018 4:38 am

Are you installing the NCPA agent and the check_ncpa.py plugin on the same machine? You need to have the plugin installed on the Nagios Core box (in the libexec directory), but the agent needs to be installed on the remote machine...


I installed the NCPA agent and the check_ncpa.py plugin on the same machine, cause i wanted to monitor the nagios core box with the ncpa agent, just like if it was a remote machine. Do you think i have to test the agent on another host ? for exemple i install a windows server 2012, i install the ncpa agent and i try to monitor it ?

Can you run the following command from the command line on the Nagios Core box, and show the output?


I can't do this now, i will sent you the output as soon as i can
Ibouguerra
 
Posts: 5
Joined: Tue Jul 03, 2018 7:48 am

Re: Monitoring NCPA

Postby lmiltchev » Fri Jul 06, 2018 10:30 am

I installed the NCPA agent and the check_ncpa.py plugin on the same machine, cause i wanted to monitor the nagios core box with the ncpa agent, just like if it was a remote machine.

What are the metrics that you want to monitor on the local machine? Most probably you don't need an agent installed on the same box - you already have Nagios plugins installed. It wouldn't hurt anything - I am just trying to understand what is your main objective, e.g. to "test" NCPA locally, to monitor some metrics on the Nagios Core machine, such as root partition, load, memory, etc.

Do you think i have to test the agent on another host ? for exemple i install a windows server 2012, i install the ncpa agent and i try to monitor it ?

If you need to monitor Windows server 2012, then yes, install the NCPA agent on it.

I can't do this now, i will sent you the output as soon as i can

No problem, whenever you are ready.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 10722
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring NCPA

Postby Ibouguerra » Tue Jul 10, 2018 7:46 am

Hi,

I created a centos host, i installed the ncpa_agent, and i modificated the ncpa.conf like this :

Code: Select all
define host {
    host_name               centoshost
    address                 xxx.xxx.xxx.xxx
    check_command           check_ncpa!-t mytoken -P 5693 -M system/agent_version
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    contacts                nagiosadmin
    notification_interval   60
    notification_period     24x7
    notifications_enabled   1
    icon_image              ncpa.png
    statusmap_image         ncpa.png
    register                1
}

define service {
    host_name               centoshost
    service_description     CPU Usage
    check_command           check_ncpa!-t mytoken -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmin
    register                1
}

define service {
    host_name               centoshost
    service_description     Memory Usage
    check_command           check_ncpa!-t mytoken-P 5693 -M memory/virtual -w 50 -c 80 -u G
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmin
    register                1
}

define service {
    host_name               centoshost
    service_description     Process Count
    check_command           check_ncpa!-t mytoken -P 5693 -M processes -w 150 -c 200
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_interval   60
    notification_period     24x7
    contacts                nagiosadmin
    register                1
}


But i still dont have any result in the nagios web interface, i dont know if i missed a step in the configuration of nagios to monitor host...

Can you run the following command from the command line on the Nagios Core box, and show the output?

I ran it, and i had this result :
Code: Select all
OK: Agent_version was ['2.1.5']


Edit :

I found my mistake, i add the follow line to the /usr/local/nagios/etc/nagios.cfg file :
Code: Select all
cfg_file=/usr/local/nagios/etc/objects/ncpa.cfg


Now i can see the host on the nagios web interface, but it appears in down, with those type of error message :
(Return code of 13 for service 'CPU Usage' on host 'centoshost' was out of bounds)


I keep investigate.

Edit 2 :

I ran this command :
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H <remote IP> -t <token> -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'

and the result is :
Code: Select all
OK: Percent was 0.00 % | 'percent'=0.00%;20;40;


Edit 3 :

I found what was wrong... i was logged in root... i did all the install in root user and i didn'nt notice that the user "nagios" was'nt able to run "check_ncpa.py". i now understand why you were asking me to run this command.

I'm sorry if my mistake took your time, and i really thank you
Ibouguerra
 
Posts: 5
Joined: Tue Jul 03, 2018 7:48 am

Re: Monitoring NCPA

Postby lmiltchev » Tue Jul 10, 2018 11:10 am

No problem! I am glad your issue has been resolved! Do you have any more questions or it is ok to close this topic?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 10722
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring NCPA

Postby Ibouguerra » Wed Jul 11, 2018 9:55 am

It's ok to close this topic, do i have to do something to close it or you will do it ?
Ibouguerra
 
Posts: 5
Joined: Tue Jul 03, 2018 7:48 am

Re: Monitoring NCPA

Postby lmiltchev » Wed Jul 11, 2018 11:40 am

I will close it. Thanks!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 10722
Joined: Mon May 23, 2011 12:15 pm


Return to Nagios Core

Who is online

Users browsing this forum: 2iretegas and 40 guests