NRPE:Unable to read output
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
NRPE:Unable to read output
How difficult would it be to modify check_nrpe to return code 3 for "cannot read output" instead of a warning code? The only reason I ask is because we have a zone memory and zone CPU check that runs a prstat -Z on our global servers and greps the zone name to tell us how much memory and CPU our zones are using. Well, whenever we patch our servers, all of our NRPE checks work fine, except for these zone checks which means lots and lots of notifications are being sent. Currently, we aren't sending email notifications for "Unknown" status alerts, so if we could change this "unable to read output" exit code to come up as unknown that would solve our issue.
Re: NRPE:Unable to read output
Not *too* hard I wouldn't think. Relevant code in send_nrpe.c line 311:
Probably wanna throw an else if in there to check for "Unable to read output" and act set the var "result" to 3.
Code: Select all
/* print the output returned by the daemon */
receive_packet.buffer[MAX_PACKETBUFFER_LENGTH-1]='\x0';
if(!strcmp(receive_packet.buffer,""))
printf("CHECK_NRPE: No output returned from daemon.\n");
else
printf("%s\n",receive_packet.buffer);
Former Nagios employee
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: NRPE:Unable to read output
Should have specified on my lack of coding knowledge, lol. The check_nrpe I have on my server appears to already be compiled, and thus cannot be modified. How would I go about modifying the appropriate lines?
Re: NRPE:Unable to read output
Probaly not that hard. Grab the source for nrpe from github. Edit:
Change lines 1389-1390 from:
To:
And rebuild.
Please note - *I have not tested this*
(It is but conjecture)
Code: Select all
nrpe.cCode: Select all
else if(!strcmp(buffer,""))
snprintf(buffer,sizeof(buffer)-1,"NRPE: Unable to read output\n");Code: Select all
else if(!strcmp(buffer,"")) {
snprintf(buffer,sizeof(buffer)-1,"NRPE: Unable to read output\n");
result=STATE_UNKNOWN;
}Please note - *I have not tested this*
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.
"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.
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: NRPE:Unable to read output
sorry if this is a stupid question, but I need more info on the "rebuild part". I'm not a programmer, just a lowly netadmin that got stuck with Nagios (new guy, etc.) so this kind of thing isn't one of my stronger areas. I've modified the nrpe.c file, and looking at the readme it looks like I need to
Is that correct? If so, where does it put the new check_nrpe? Do I also need to roll out a new nrpe.conf to all our servers?
Code: Select all
./compile
make allRe: NRPE:Unable to read output
Usually it's
Might not need the second step here, but it won't break anything.
Code: Select all
./configure
make
make install
Former Nagios employee
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: NRPE:Unable to read output
Ah gotcha. K, I'm no expert (again), but it looks like I'm getting an error after the 'make install' command:
Code: Select all
[root@nagiosTEST nrpe-2.15]# make install
cd ./src/ && make install
make[1]: Entering directory `/tmp/nrpe-2.15/src'
make install-plugin
make[2]: Entering directory `/tmp/nrpe-2.15/src'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/libexec
/usr/bin/install -c -m 775 -o nagios -g nagios check_nrpe /usr/local/nagios/libexec
/usr/bin/install: cannot stat `check_nrpe': No such file or directory
make[2]: *** [install-plugin] Error 1
make[2]: Leaving directory `/tmp/nrpe-2.15/src'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/tmp/nrpe-2.15/src'
make: *** [install] Error 2
[root@nagiosTEST nrpe-2.15]#
Re: NRPE:Unable to read output
And you did run the ./configure before, correcT?
Former Nagios employee
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: NRPE:Unable to read output
Yep. Ran all three actually, ./configure, make, make install. No errors that I can see from the ./configure or 'make', but I can copy all of that in too if you want in case I missed something.
Re: NRPE:Unable to read output
Sometimes you can get this error if openssl-devel package is not installed. Try running:
Then try to recompile again. Let me know if this helped.
Code: Select all
yum install openssl-devel -yBe sure to check out our Knowledgebase for helpful articles and solutions!