setting up nrdp

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.
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

setting up nrdp

Post by jssingh »

I'm trying to switch from nsca to nrdp. I'm sure I'm missing some really obvious step somewhere, but how do I get NRDP to connect to the Nagios installation? I installed NRDP and I can see the test API page. And I get this error: "COMMAND FILE UNWRITEABLE". I'm guessing because I didn't link NRDP to the nagios command file ... how do I do that?

thanks,
-janice
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: setting up nrdp

Post by lmiltchev »

Can you post the "config.inc.php" file? Hide the sensitive info - the tokens, etc.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Xperteks
Posts: 7
Joined: Thu Jan 30, 2014 1:28 pm

Re: setting up nrdp

Post by Xperteks »

You might try to check your nagios.cfg file as well.

Check for the section labeled: EXTERNAL COMMAND OPTION and see if that is a '1' or a '0' - it has to be '1' to enable the external commands which is how NRDP sends data to Nagios. (I think, I'm new)
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

Re: setting up nrdp

Post by jssingh »

Thanks for the replies. I looked at the config file again and realized I missed this line:
NOTE: both the Apache and Nagios users must be a member of this group
I've requested a new group (I can't just edit /etc/group), but it's taking awhile for it to get created. Hopefully it will be created soon and I can try again!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: setting up nrdp

Post by slansing »

Awesome, let us know, that is likely the issue.
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

Re: setting up nrdp

Post by jssingh »

So I *finally* was able to get the group account and I'm still having problems. I did a chgrp -R on the entire /usr/local/nagios4 directory, just to be sure. Here is my config file:

Code: Select all

cat config.inc.php 
<?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(
	//"mysecrettoken",  // <-- 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(
	"******"
	);
	
// 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"]="****";

// full path to Nagios external command file
$cfg["command_file"]="/usr/local/nagios4/var/rw/nagios.cmd";

// full path to check results spool directory
$cfg["check_results_dir"]="/usr/local/nagios4/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/nagios4/var/tmp";

	
///////// DONT MODIFY ANYTHING BELOW THIS LINE /////////

$cfg['product_name']='nrdp';
$cfg['product_version']='1.0'


?>

This is the error I get:
COMMAND FILE UNWRITEABLE
And my nagios.cfg file does allow external commands.


Any thoughts?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: setting up nrdp

Post by slansing »

What is the output of:

Code: Select all

ls -la /usr/local/nagios4/var/rw/nagios.cmd
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

Re: setting up nrdp

Post by jssingh »

I have to redact the user and group name, but the group name is the same as the one in the config file:

Code: Select all

$ ls -la /usr/local/nagios4/var/rw/nagios.cmd
prw-rw---- 1 ****** **** 0 Oct 31 14:10 /usr/local/nagios4/var/rw/nagios.cmd
$
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: setting up nrdp

Post by lmiltchev »

Normally, the "nagios.cmd" should be owned by nagios:nagcmd. What is the output of the following command?

Code: Select all

grep nag /etc/group
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

Re: setting up nrdp

Post by jssingh »

I can't post that output ... but nagios.cmd is owned by the user dedicated for nagios. And I chose the group based on this comment:
// 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
Locked