Pipe Hung

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
FCC_Nagios_Support
Posts: 161
Joined: Tue Mar 10, 2020 11:07 am

Pipe Hung

Post by FCC_Nagios_Support »

Hi,

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

Aby Idea
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Pipe Hung

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked