Page 1 of 2

MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Wed Mar 18, 2015 12:06 pm
by fermatcapital
PROBLEM
My NCPA server does not recognize plugins. I have NCPA 1.7.2 running on CentOS and the plugins are listed in the web API interface.

Please advise.

LOG OUTPUT
However on a MacOSX 10.10.2, the plugins are not listed and see this the ncpa_listener.log file:

Code: Select all

2015-03-18 12:37:46,101 96165 DEBUG Initializing WebSocket
2015-03-18 12:37:46,101 96165 DEBUG Validating WebSocket request
2015-03-18 12:37:46,102 96165 DEBUG Getting accessor: 
2015-03-18 12:37:46,110 96165 WARNING Unable to assemble plugins. Does the directory exist? - OSError(2, 'No such file or directory')
2015-03-18 12:37:46,160 96165 INFO 127.0.0.1 - - [2015-03-18 12:37:46] "GET /api/ HTTP/1.1" 200 14998 0.058587

Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Wed Mar 18, 2015 1:33 pm
by jolson
Which directory are the plugins stored in? Is the 'plugin_path' set properly in ncpa.cfg?

Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Wed Mar 18, 2015 1:36 pm
by fermatcapital
jolson wrote:Which directory are the plugins stored in? Is the 'plugin_path' set properly in ncpa.cfg?
I believe so. I did this exercise with CentOS. The config comes stock, which points to the /usr/local/ncpa/plugins directory.

Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Wed Mar 18, 2015 2:16 pm
by jolson
Did you follow the steps outlined here: http://assets.nagios.com/downloads/ncpa ... n-mac-os-x
What this script does:

Creates the folder /usr/local/ncpa if it does not exist
Moves all necessary files there
Sets the owner of /usr/local/ncpa to nagios:nagcmd
Sets the mode of /usr/local/ncpa to 775
Creates the group nagcmd if it does not exist
Creates the user nagios if it does not exist
Starts the listener daemon

If any of this fails, you will need to do the steps manually. The steps that may fail most often are adding users and groups. If they do, add the user ‘nagios’ and make sure the group ‘nagcmd’ exists and that ‘nagios’ user is in the group ‘nagcmd’.
Please let me know if any step above has failed - check on the folders, permissions, users and groups to verify that they are all present.

Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Wed Mar 18, 2015 2:31 pm
by ssax
Also, please post the output of the following commands:

Code: Select all

ls -ld /usr/local/ncpa/plugins
ls -l /usr/local/ncpa/plugins

Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Wed Mar 18, 2015 4:03 pm
by fermatcapital
I have verified the installation steps. I used dscl to verify the creation of nagcmd group:

Code: Select all

/Local/Default/Groups > cat nagcmd
AppleMetaNodeLocation: /Local/Default
GeneratedUID: E6C528F1-CAE8-40F8-AC03-A663F3F324F3
Password: *
PrimaryGroupID: 20
RealName: nagcmd
RecordName: nagcmd
RecordType: dsRecTypeStandard:Groups
Note that the PrimaryGroupID is the same as staff

Code: Select all

/Local/Default/Groups > cat staff
AppleMetaNodeLocation: /Local/Default
GeneratedUID: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000014
GroupMembers: FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000 2A9128F2-6DC4-4054-91F5-F94ADD62CFFB AD269FF7-861A-4259-8980-48B46FD278CB 9A18FD65-E4DB-495C-864A-C8ECDBF16A99 FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000037 FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000E1 FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000038 FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000ED FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000EE FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000056 FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000055
GroupMembership: root mike nagios test _pcastagent _pcastlibrary _pcastserver _xcsbuildagent _xcscredserver _xgridagent _xgridcontroller
Password: *
PrimaryGroupID: 20
RealName: Staff
RecordName: staff BUILTIN\Users
RecordType: dsRecTypeStandard:Groups
SMBSID: S-1-5-32-545
I make a note of this because the ls outputs show the group as "staff" instead of "nagcmd":

Code: Select all

mikes-laptop:ncpa mike$ ls -ld /usr/local/ncpa/plugins
drwxrwxr-x@ 4 nagios  staff  136 Mar 18 16:55 /usr/local/ncpa/plugins
mikes-laptop:ncpa mike$ ls -l /usr/local/ncpa/plugins
total 272
-rwxrwxr-x  1 nagios  staff  132684 Mar 16 11:15 check_disk
-rwxrwxr-x  1 nagios  staff    3186 Mar 16 10:48 check_file_age

Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Wed Mar 18, 2015 4:11 pm
by fermatcapital
I forgot to show that nagios belongs to nagcmd, which it does since it's PrimaryGroupID is 20 (=staff or nagcmd)

Code: Select all

/Local/Default/Users > cat nagios
dsAttrTypeNative:accountPolicyData:
 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>creationTime</key>
	<real>1413565645.3117881</real>
	<key>passwordLastSetTime</key>
	<real>1424122602.544621</real>
</dict>
</plist>

dsAttrTypeNative:naprivs: 0
AppleMetaNodeLocation: /Local/Default
AuthenticationAuthority: ;Kerberosv5;;nagios@LKDC:SHA1.12F6565C7AA4B838C15E121F7A898F068C5E85BD;LKDC:SHA1.12F6565C7AA4B838C15E121F7A898F068C5E85BD ;ShadowHash;HASHLIST:<SALTED-SHA512-PBKDF2>
GeneratedUID: AD269FF7-861A-4259-8980-48B46FD278CB
Password: ********
PrimaryGroupID: 20
RecordName: nagios
RecordType: dsRecTypeStandard:Users
UniqueID: 512

Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Thu Mar 19, 2015 12:25 pm
by jolson
There should be an 'ncpa.cfg' on your OSX machine. Could you cat that file for us please?

Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Thu Mar 19, 2015 1:03 pm
by fermatcapital
jolson wrote:There should be an 'ncpa.cfg' on your OSX machine. Could you cat that file for us please?
Here you go:

Code: Select all

[listener]
uid = nagios
certificate = adhoc
loglevel = debug 
ip = 0.0.0.0
gid = nagcmd
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid

[passive]
uid = nagios
handlers = nrds,nrdp
loglevel = debug
gid = nagcmd
sleep = 300
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid

[nrdp]
token = nrdptoken    
hostname = yourhostname
parent = yourparent

[nrds]
url = None
CONFIG_VERSION = None
token = None
CONFIG_NAME = None
CONFIG_OS = None

[api]
community_string = mytoken

[plugin directives]
plugin_path = plugins/
.sh = /bin/sh $plugin_name $plugin_args
.ps1 = powershell -ExecutionPolicy Unrestricted -File $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


Re: MacOSX NCPA 1.7.1 and 1.7.2: Not recognizing plugins

Posted: Thu Mar 19, 2015 1:24 pm
by jolson
I understand that 'staff' and 'nagcmd' currently have the same GID, however I would like you to change all file and directory permissions that are currently 'staff' to 'nagcmd' and see if that helps. Thank you!