From: Tim W. <tim...@gm...> - 2004-11-23 07:00:28
|
Yves, On Mon, 22 Nov 2004 11:07:42 +0100 (CET), Yves <yme...@pe...> wrote: > > > > > Has anyone managed to use 'method 4' , i.e. make nagios write to a > > pipe that is read by perfparsed? > > > > I managed to get it to work once, but then I killed perfparsed and > > tried to restart it and it never comes up again. In the error log I > > see this: > > 2004/11/22 10:11:18 [log_reader.c:370 9800 ] Could not create fifo > > '/usr/local/nagios/var/perfparse.pipe' > > > > The problem is that perfparse.pipe still exists from the previous run. > > But you can't get rid of it, because nagios is constantly writing to > > it. If you remove it, it instantly reappears as a regular file! > > Yes, of course. In a perfect world, nagios (the nagios command that outputs to the pipe) > should test if the file exists and if it is a pipe, or raise an error. > In our world, what can we do ? We can rewrite the command that writes to the pipe :) I added a check to perfparse_nagios_pipe_command.pl that check if $file is a pipe. I use nagios 1.x, so it's not a bug in nagios. (pfew :) ) > > > OK, I could shutdown nagios and restart perfparsed first and then > > nagios again, but this is not really an acceptable solution. > > What version of nagios are you using ? Any version with some command that printf >> > perfparse.pipe ? Or nagios-2.0cvs with the new feature : output perfdata to a pipe ? > > In the second case, this would be a bug in nagios and should be addressed to nagios > developers. > In the first case... > 1 update your command to get closer from the perfect world ? You can do it, but will > others do it too ? > 2 update perfparsed to take care of this ? But fixing somewhere a bug of somewhere else > is never a good solution. We get away from the perfect world. > 3 ask the user to reboot nagios at the same time as perfparsed restarts ? But is this a > good solution ? > > I have an idea for (2) : when perfparsed starts and finds the existing file > perfparse.pipe, it can rename it and create the fifo. Then it's your work to cat > perfparse.pipe.old > perfparse.pipe. And it supposes that nagios closes the file and > reopens it every time there is something to write. Otherwise, the only way is to reboot > nagios. > > Is this a correct workaround ? Perfparsed definitely needs a fix, because the code that creates the fifo queue fails if the queue (or file) already exists, and perfparsed always exits. So a better fix would be: if file exists { if file is a pipe { do nothing } else { rename the file (remove?) mkfifo } } else { mkfifo } Tim. > > > > My perfparse.cfg: > > nagios@naxos:~/etc$ cat perfparse.cfg > > Please run perfparsed --show_config instead :) > In next version, I will write at the beginning of the exemple config file to run the > binary with --show_config instead of showing the config file. > However, thanks for sending the config file that usually helps us to find good things :) > > Yves > |