I want to use NRDP Plugin for the same, I have:
Nagios Core : 4.0.2 Running on Server A
NRDP 1.2 : Running on Server A.
NCPA : 1.1 Running on Client B.
My Nagios core is working fine and monitoring localhost i.e. Server A.
My NRDP configuration file
Code: Select all
/usr/local/nrdp/server/config.inc.php
Code: Select all
<?php
// NRDP Config File
// Copyright (c) 2010 Nagios Enterprises, LLC.
// License: Nagios Open Software License <http://www.nagios.com/legal/licenses>
//
// $Id: config.inc.php 12 2010-06-19 04:19:35Z egalstad $
// an array of one or more tokens that are valid for this NRDP install
// a client request must contain a valid token in order for the NRDP to response or honor the request
// NOTE: tokens are just alphanumeric strings - make them hard to guess!
$cfg['authorized_tokens'] = array(
"nrdp", // <-- not a good token
//"90dfs7jwn3", // <-- a better token (don't use this exact one, make your own)
);
// do we require that HTTPS be used to access NRDP?
// set this value to 'false' to disable HTTPS requirement
$cfg["require_https"]=false;
// do we require that basic authentication be used to access NRDP?
// set this value to 'false' to disable basic auth requirement
$cfg["require_basic_auth"]=false;
// what basic authentication users are allowed to access NRDP?
// comment this variable out to allow all authenticated users access to the NRDP
$cfg["valid_basic_auth_users"]=array(
"nrdpuser"
);
// the name of the system group that has write permissions to the external command file
// this group is also used to set file permissions when writing bulk commands or passive check results
// NOTE: both the Apache and Nagios users must be a member of this group
$cfg["nagios_command_group"]="nagcmd";
// full path to Nagios external command file
$cfg["command_file"]="/usr/local/nagios/var/rw/nagios.cmd";
// full path to check results spool directory
$cfg["check_results_dir"]="/usr/local/nagios/var/spool/checkresults";
// full path to directory where temp scratch files can be written
// NOTE: the Apache user need to be able create files here, and the Nagios user needs to read/delete those same files, so the /tmp system directory won't work (it has a sticky bit on it)
$cfg["tmp_dir"]="/usr/local/nagios/var/tmp";
///////// DONT MODIFY ANYTHING BELOW THIS LINE /////////
$cfg['product_name']='nrdp';
$cfg['product_version']='1.0'
?>
And On Client B : My NCPA configuration
Code: Select all
/usr/local/ncpa/etc/ncpa.cfg
Code: Select all
[listener]
uid = root
certificate = adhoc
loglevel = info
ip = 0.0.0.0
gid = root
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid
[passive]
uid = nagios
handlers = nrdp
loglevel = info
gid = nagcmd
sleep = 300
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid
[nrdp]
token = nrdp
hostname = Dhruv
parent = http://192.168.3.222/nrdp/
[nrds]
url = None
CONFIG_VERSION = None
token = None
CONFIG_NAME = Freddy
CONFIG_OS = None
[api]
community_string = mytoken
[plugin directives]
plugin_path = plugins/
.sh = /bin/sh $plugin_name $plugin_args
.ps1 = powershell -ExecutionPolicy Unrestricted $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo
[passive checks]
%HOSTNAME%|cpu usage = /cpu/percent --warning 20 --critical 30
%HOSTNAME%|swap usage = /memory/swap/percent --warning 40 --critical 80
%HOSTNAME%|memory usage = /memory/virtual/percent --warning 60 --critical 80
~
Now When I try to run command from server A to monitor client B. I get following error.
Code: Select all
[root@target nrdp]# /usr/local/nagios/libexec/check_ncpa.py -vt 'mytoken' -H 192.168.3.100 -M cpu/percent -w 20 -c 40
Connecting to: https://192.168.3.100:5693/api/cpu/percent?token=mytoken&warning=20&critical=40&check=1
An error occurred:('http protocol error', 0, 'got a bad status line', None)
And When I connect to
Code: Select all
https://192.168.3.100:5693/api/cpu/percent?token=mytoken&warning=20&critical=40&check=1
Code: Select all
{
"value": {
"returncode": 0,
"stdout": "OK: Percent was 0.0%,0.0%,0.0%,0.0%,0.0%,0.0%,0.0%,0.0%|'percent_0'=0.0%;20;40 'percent_1'=0.0%;20;40 'percent_2'=0.0%;20;40 'percent_3'=0.0%;20;40 'percent_4'=0.0%;20;40 'percent_5'=0.0%;20;40 'percent_6'=0.0%;20;40 'percent_7'=0.0%;20;40"
}
}
Any suggestion?