Nagios 4 and Pnp4Nagios

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.
ahmad786
Posts: 2
Joined: Fri Mar 29, 2013 11:42 am

Nagios 4 and Pnp4Nagios

Post by ahmad786 »

Hi guys,

I upgraded to Nagios4 everything are ok in Nagios, but I got an error in pnp4nagios!! I got that in log :

[1380291692] wproc: SERVICE PERFDATA job 59556 from worker Core Worker 404 is a non-check helper but exited with return code 2
[1380291692] wproc: command: /home/prog/pnp4nagios/libexec/process_perfdata.pl
[1380291692] wproc: early_timeout=0; exited_ok=1; wait_status=512; error_code=0;
[1380291692] Worker 404: Unknown jobtype: 10
[1380291692] wproc: Unknown job type: 10

can you help me please ?
thank you
kao_lance
Posts: 4
Joined: Fri Sep 27, 2013 10:45 am

Re: Nagios 4 and Pnp4Nagios

Post by kao_lance »

I am setting up a new Nagios installation so I installed 4.0.0beta4 then upgraded to 4.0.0. I installed pnp4nagios for the first time after upgrading to 4.0.0 and I am having the same problem. Also I enabled debug for the process_perfdata script and I'm getting this:

Code: Select all

2013-09-27 11:50:13 [27948] [2] Using Config File /usr/local/pnp4nagios/etc/process_perfdata.cfg parameters
2013-09-27 11:50:13 [27948] [2] Default Timeout: 15 secs.
2013-09-27 11:50:13 [27948] [2] Config Timeout: 15 secs.
2013-09-27 11:50:13 [27948] [2] Actual Timeout: 15 secs.
2013-09-27 11:50:13 [27948] [1] process_perfdata.pl-0.6.21 starting in SYNC Mode
2013-09-27 11:50:13 [27948] [1] Cant find Nagios Environment. Exiting ....
I do have the environment option enabled:

Code: Select all

# grep environment /usr/local/nagios/etc/nagios.cfg
# macros available as environment variables when host/service checks
# out of environment space. It will also cause a significant increase
# Values: 1 - Enable environment variable macros
#         0 - Disable environment variable macros (default)
enable_environment_macros=1
#
I have restarted Apache and Nagios to be sure... didn't help.

Is the current version of pnp4nagios (0.6.21) not compatible with Nagios 4?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios 4 and Pnp4Nagios

Post by abrist »

kao_lance wrote:Is the current version of pnp4nagios (0.6.21) not compatible with Nagios 4?
Unknown. I didn't test 4 all the way down the rabbit hole. If I get a chance over the next few days, I will update one of my nagvis/pnp4nagios/nagiosql core installs to 4.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
kao_lance
Posts: 4
Joined: Fri Sep 27, 2013 10:45 am

Re: Nagios 4 and Pnp4Nagios

Post by kao_lance »

Well I changed my perfdata commands to call a simple shell script, debug.sh which does only this:

Code: Select all

#!/bin/bash
env > /tmp/env.debug
Upon inspecting /tmp/env.debug, I don't see any variables begining with NAGIOS_:

Code: Select all

# grep -i NAGIOS /tmp/env.debug 
USER=nagios
HOME=/usr/local/nagios
LOGNAME=nagios
#
So it looks like enable_environment_macros=1 isn't really working... or do I misunderstand how this should work?

EDIT.... Found this: http://tracker.nagios.org/view.php?id=498
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios 4 and Pnp4Nagios

Post by sreinhardt »

I do not believe that is how it is intended, although that bug report may be an indication that it is not actually working. My understanding was that you had to directly reference the $NAGIOS_***** variable specifically and it was only available when a check or event handler is run, to that environment. We will do some checking and see.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
kao_lance
Posts: 4
Joined: Fri Sep 27, 2013 10:45 am

Re: Nagios 4 and Pnp4Nagios

Post by kao_lance »

sreinhardt wrote:I do not believe that is how it is intended, although that bug report may be an indication that it is not actually working. My understanding was that you had to directly reference the $NAGIOS_***** variable specifically and it was only available when a check or event handler is run, to that environment. We will do some checking and see.
Well, if I set my perfdata handler to be my debug.sh script, the environment should be passed into it. And env shows you all defined environment variables so I would expect to see some NAGIOS_* varibles listed.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios 4 and Pnp4Nagios

Post by sreinhardt »

Well, I can't really argue with the logic, I guess we shall have to see what comes of the bug report at this point.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
trey85stang
Posts: 10
Joined: Thu Apr 28, 2011 4:39 pm

Re: Nagios 4 and Pnp4Nagios

Post by trey85stang »

sreinhardt wrote:I do not believe that is how it is intended, although that bug report may be an indication that it is not actually working. My understanding was that you had to directly reference the $NAGIOS_***** variable specifically and it was only available when a check or event handler is run, to that environment. We will do some checking and see.
Just to give a heads up, here is that env script with nagios 3.4.3 (few things removed):

Code: Select all

NAGIOS_SERVICESTATE=CRITICAL
NAGIOS_HOSTNOTIFICATIONNUMBER=0
NAGIOS_HOSTNOTIFICATIONID=0
NAGIOS_ARG8=
NAGIOS_SERVICEACKAUTHOR=
NAGIOS_COMMANDFILE=/usr/local/nagios/var/rw/nagios.cmd
NAGIOS_ARG9=
NAGIOS_LASTHOSTDOWN=0
NAGIOS_LASTSERVICEWARNING=0
NAGIOS_TEMPPATH=/tmp
NAGIOS_TOTALHOSTSERVICESCRITICAL=1
NAGIOS_HOSTACKAUTHOR=
NAGIOS_TEMPFILE=/usr/local/nagios/var/nagios.tmp
NAGIOS_NOTIFICATIONAUTHOR=
NAGIOS_ISVALIDTIME=
SHELL=/bin/bash
TERM=xterm
NAGIOS_SERVICEGROUPALIAS=
NAGIOS_ARG28=
HISTSIZE=1000
NAGIOS_HOSTEXECUTIONTIME=0.000
NAGIOS_SERVICEACKCOMMENT=
NAGIOS_NOTIFICATIONISESCALATED=0
NAGIOS_ARG29=
NAGIOS_LOGFILE=/usr/local/nagios/var/nagios.log
NAGIOS_TOTALHOSTSUNREACHABLEUNHANDLED=
NAGIOS_SERVICEACKAUTHORNAME=
NAGIOS_NEXTVALIDTIME=
NAGIOS_ARG26=
NAGIOS_TIMET=1380314303
NAGIOS_HOSTGROUPNAMES=servers-linux,servers-dell,ping,dal
NAGIOS_MAXSERVICEATTEMPTS=3
NAGIOS_ARG1=
NAGIOS_ARG27=
NAGIOS_HOSTSTATEID=0
NAGIOS_LASTSERVICECRITICAL=1380314300
NAGIOS_ARG2=
NAGIOS_ARG24=
NAGIOS_EVENTSTARTTIME=1380314253
NAGIOS_ARG3=
NAGIOS_ARG25=
NAGIOS_HOSTACKCOMMENT=
NAGIOS_SERVICENOTES=
NAGIOS_SERVICEGROUPNOTESURL=
NAGIOS_NOTIFICATIONCOMMENT=
NAGIOS_ARG4=
NAGIOS_ARG22=
NAGIOS_TOTALHOSTPROBLEMSUNHANDLED=
NAGIOS_HOSTEVENTID=0
NAGIOS_ARG5=
NAGIOS_ARG23=
NAGIOS_TOTALHOSTSERVICESOK=14
NAGIOS_ARG6=
NAGIOS_ARG20=
NAGIOS_TIME=16:38:23
NAGIOS_HOSTACTIONURL=
NAGIOS_CONTACTGROUPALIAS=
NAGIOS_ARG7=
NAGIOS_ARG21=
NAGIOS_SERVICEPERFDATA=
NAGIOS_LASTSERVICESTATE=CRITICAL
USER=nagios
NAGIOS_HOSTPERCENTCHANGE=0.00
NAGIOS_HOSTGROUPALIAS=Servers: Linux
NAGIOS_RESOURCEFILE=/usr/local/nagios/etc/resource.cfg
NAGIOS_CONTACTGROUPMEMBERS=
NAGIOS_ARG19=
NAGIOS_SERVICECHECKTYPE=PASSIVE
NAGIOS_ARG18=
NAGIOS_SERVICEATTEMPT=3
NAGIOS_TOTALHOSTSDOWNUNHANDLED=
NAGIOS_HOSTDOWNTIME=0
NAGIOS_HOSTCHECKCOMMAND=stale-freshness!3!Host_Check_Not_Recieved
NAGIOS_TOTALHOSTSERVICESUNKNOWN=0
NAGIOS_SERVICEGROUPNAME=
NAGIOS_SERVICEGROUPACTIONURL=
NAGIOS_LASTSERVICESTATECHANGE=1380314299
NAGIOS_RETENTIONDATAFILE=/usr/local/nagios/var/retention.dat
NAGIOS_TOTALSERVICEPROBLEMSUNHANDLED=
NAGIOS_LASTSERVICEEVENTID=824
NAGIOS_TOTALHOSTSERVICES=15
NAGIOS_CONTACTGROUPNAME=
NAGIOS_ARG13=
NAGIOS_CONTACTPAGER=
NAGIOS_NOTIFICATIONTYPE=PROBLEM
NAGIOS_LASTSERVICEPROBLEMID=403
NAGIOS_ARG12=
NAGIOS_LASTHOSTCHECK=1380314058
NAGIOS_ADMINPAGER=pagenagios@localhost
NAGIOS_SERVICECHECKCOMMAND=stale-freshness!3!Service_Check_Not_Recieved
NAGIOS_TOTALSERVICESWARNING=
NAGIOS_LASTHOSTSTATEID=0
NAGIOS_ARG11=
NAGIOS_HOSTPERFDATA=rta=0.125000ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0
NAGIOS_LASTSERVICEOK=1380314053
NAGIOS_TOTALHOSTSDOWN=
NAGIOS_SERVICENOTIFICATIONNUMBER=1
NAGIOS_CONTACTGROUPNAMES=
NAGIOS_ARG10=
NAGIOS_SERVICEPERCENTCHANGE=18.36
NAGIOS_TOTALHOSTPROBLEMS=
NAGIOS_TOTALSERVICESOK=
NAGIOS_TOTALHOSTSERVICESWARNING=0
NAGIOS_ARG17=
MAIL=/var/spool/mail/root
PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAGIOS_HOSTOUTPUT=PING OK - Packet loss = 0%, RTA = 0.12 ms
NAGIOS_ARG16=
NAGIOS_MAXHOSTATTEMPTS=3
NAGIOS_ARG15=
_=/bin/env
NAGIOS_TOTALHOSTSUNREACHABLE=
NAGIOS_TOTALSERVICESWARNINGUNHANDLED=
NAGIOS_ARG14=
NAGIOS_STATUSDATAFILE=/usr/local/nagios/var/status.dat
NAGIOS_TOTALSERVICESUNKNOWN=
NAGIOS_LASTHOSTPROBLEMID=0
NAGIOS_ARG31=
PWD=/
NAGIOS_SHORTDATETIME=09-27-2013 16:38:23
NAGIOS_HOSTSTATE=UP
NAGIOS_LASTHOSTUP=1380314065
NAGIOS_SERVICEGROUPNOTES=
NAGIOS_ARG30=
NAGIOS_SERVICEPERFDATAFILE=/usr/local/nagios/var/perfdata.log
NAGIOS_ARG32=
LANG=en_US.UTF-8
NAGIOS_CONTACTALIAS=TESTING
NAGIOS_HOSTNOTESURL=
NAGIOS_SERVICELATENCY=0.378
NAGIOS_TOTALSERVICESCRITICAL=
NAGIOS_SERVICEDOWNTIME=0
NAGIOS_SERVICEGROUPNAMES=
NAGIOS_DATE=09-27-2013
NAGIOS_SERVICEEVENTID=851
NAGIOS_HOSTACKAUTHORALIAS=
NAGIOS_NOTIFICATIONAUTHORALIAS=
NAGIOS_SERVICEDURATION=0d 0h 0m 4s
NAGIOS_HOSTSTATETYPE=HARD
NAGIOS_SERVICEPROBLEMID=417
NAGIOS_HOSTCHECKTYPE=PASSIVE
NAGIOS_HOSTGROUPNOTES=
HISTCONTROL=ignoredups
NAGIOS_LASTSERVICECHECK=1380314300
NAGIOS_ADMINEMAIL=nagios@localhost
NAGIOS_OBJECTCACHEFILE=/usr/local/nagios/var/objects.cache
NAGIOS_HOSTLATENCY=0.000
NAGIOS_HOSTGROUPACTIONURL=
SHLVL=5
HOME=/usr/local/nagios/var/spool
NAGIOS_LONGDATETIME=Fri Sept 27 16:38:23 EDT 2013
NAGIOS_SERVICESTATEID=2
NAGIOS_SERVICENOTESURL=
NAGIOS_TOTALSERVICEPROBLEMS=
NAGIOS_HOSTPROBLEMID=0
NAGIOS_CONTACTADDRESS0=
NAGIOS_HOSTDURATIONSEC=81073
NAGIOS_TOTALSERVICESUNKNOWNUNHANDLED=
NAGIOS_LASTHOSTSTATE=UP
NAGIOS_CONTACTADDRESS1=
NAGIOS_SERVICEEXECUTIONTIME=0.000
NAGIOS_TOTALSERVICESCRITICALUNHANDLED=
NAGIOS_CONTACTADDRESS2=
LOGNAME=nagios
NAGIOS_LONGHOSTOUTPUT=
NAGIOS_SERVICEGROUPMEMBERS=
NAGIOS_CONTACTADDRESS3=
CVS_RSH=ssh
NAGIOS_SERVICEDURATIONSEC=4
NAGIOS_CONTACTADDRESS4=
NAGIOS_HOSTGROUPNOTESURL=
NAGIOS_CONTACTADDRESS5=
NAGIOS_NOTIFICATIONNUMBER=1
NAGIOS_HOSTDURATION=0d 22h 31m 13s
LESSOPEN=|/usr/bin/lesspipe.sh %s
NAGIOS_MAINCONFIGFILE=/usr/local/nagios/etc/nagios.cfg
NAGIOS_CONTACTEMAIL=
NAGIOS_SERVICESTATETYPE=HARD
NAGIOS_LASTHOSTUNREACHABLE=0
NAGIOS_LONGSERVICEOUTPUT=
NAGIOS_HOSTATTEMPT=1
NAGIOS_HOSTNOTES=
NAGIOS_SERVICEISVOLATILE=0
NAGIOS_SERVICEDISPLAYNAME=Hard Disk - /mnt/storage
NAGIOS_TOTALHOSTSUP=
NAGIOS_LASTHOSTSTATECHANGE=1380233230
NAGIOS_LASTSERVICEUNKNOWN=0
NAGIOS_HOSTPERFDATAFILE=
NAGIOS_LASTHOSTEVENTID=0
NAGIOS_HOSTACKAUTHORNAME=
NAGIOS_NOTIFICATIONAUTHORNAME=
G_BROKEN_FILENAMES=1
]NAGIOS_SERVICEDESC=Hard Disk - /mnt/storage
NAGIOS_HOSTGROUPNAME=servers-linux
NAGIOS_PROCESSSTARTTIME=1380314252
NAGIOS_SERVICENOTIFICATIONID=236
NAGIOS_SERVICEACKAUTHORALIAS=
NAGIOS_LASTSERVICESTATEID=2

That should at least show the behavior is not the same as previous versions, so Im more inclined to think this just doesnt work. I dug through the source code (im no coder) but I dont see anything that would cause these not to be populated. A lot more logic was added to ensure null macros are not exported to the environment among other things then before however.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios 4 and Pnp4Nagios

Post by sreinhardt »

Nice to know, again unfortunately this is something that will have to be resolved by the core developers within the tracker ticket already posted.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
ahmad786
Posts: 2
Joined: Fri Mar 29, 2013 11:42 am

Re: Nagios 4 and Pnp4Nagios

Post by ahmad786 »

Hi,

Unfortunately I still have not found a solution for pnp4nagios! : (
Also, since I upgraded to nagios4 I don't have any map!!

Any ideas ?

thanks
Locked