Page 1 of 1

Pipe Hung

Posted: Wed Jun 03, 2020 9:39 am
by FCC_Nagios_Support
Hi,

sometimes nagios.cmd looks with records not empty and the url submits does not run

Aby Idea

Re: Pipe Hung

Posted: Wed Jun 03, 2020 2:09 pm
by scottwilkerson
Are you submitting command directly to nagios.cmd with scripts?

nagios.cmd is a command pipe that is created when nagios starts, however if a you have scripts that are writing to the location without first verifying the pipe exists, it could be creating the file which would be problematic.

If you are using bash for this it would be recommended to check for existence of the pipe ([ -p "$commandfile" ]) before writing to it such as

Code: Select all

#!/bin/sh
# This is a sample shell script showing how you can submit the PROCESS_SERVICE_CHECK_RESULT command
# to Nagios. Adjust variables to fit your environment as necessary.

now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'

if [ -p "$commandfile" ]; then
    /bin/printf "[%lu] PROCESS_SERVICE_CHECK_RESULT;host1;service1;0;OK- Great\n" $now > $commandfile
fi