From: Tim W. <tim...@gm...> - 2004-11-22 09:24:09
|
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:12 [perfparsed.c:127 9800 ] Perfparsed successfully daemonized (pid=9800) 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! OK, I could shutdown nagios and restart perfparsed first and then nagios again, but this is not really an acceptable solution. Perhaps I'm going about it the wrong way.... Tim My perfparse.cfg: nagios@naxos:~/etc$ cat perfparse.cfg # # Config file. # # In all cases, variables used as: # # 1. From program default defined by configure. # # 2. From this file. # # 3. From variables passed to programs. # # Parser managment : # ================== # Performance Data Log Files ("-" for stdin) : Service_Log = "|/usr/local/nagios/var/perfparse.pipe" Service_Log_Position_Mark_Path = "" # Error handling : Error_Log = "/usr/local/nagios/var/perfparse_error.log" Error_Log_Rotate = "Yes" Drop_File = "/tmp/perfparse.drop" Drop_File_Rotate = "Yes" # Lock file for only one perfparse running at the same time Lock_File = "/var/lock/perfparse.lock" # Reporting options : # =================== # Do not display completion status of perfparse: Show_Status_Bar = "no" # Display a report on exit of perfparse: Do_Report = "no" # CGI managment : # =============== # Default user permissions in the CGI. Accepted values are (ro|rw|hide) Default_user_permissions_Policy = "rw" Default_user_permissions_Host_groups = "rw" # Output logger : # =============== # set Output_Log_File to "yes" to enable it Output_Log_File = "yes" Output_Log_Filename = "/usr/local/nagios/var/log/perfparse_output_log" Output_Log_Rotate = "yes" # Socket_output managment : # ========================= Use_Storage_Socket_Output = "no" Storage_Socket_Output_Host_Name = "localhost" Storage_Socket_Output_Port = "1974" # Perfparsed server managment : # ============================= Server_Port = "1976" # Database managment : # ==================== Use_Storage_Mysql = "yes" No_Raw_Data = "no" No_Bin_Data = "no" # Database Authentication DB_Host="ncc1701e" DB_User="user" DB_Pass="pass" DB_Name="nagios" # misc Dummy_Hostname = "dummy" |
From: Yves <yme...@pe...> - 2004-11-22 10:07:48
|
> 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 outpu= ts 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 ? > 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 i= t, 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 fi= le 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 t= he file and reopens it every time there is something to write. Otherwise, the only wa= y is to reboot nagios. Is this a correct workaround ? > 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 --=20 - Homepage - http://ymettier.free.fr - http://www.logicacmg.com - - GPG key - http://ymettier.free.fr/gpg.txt - - Maitretarot - http://www.nongnu.org/maitretarot/ - - Perfparse - http://perfparse.sf.net/ - |
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 > |
From: Yves <yme...@pe...> - 2004-11-23 09:08:15
|
> 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 > } You are right. And the funny is that I had the same idea later, yesterday= evening. If we have the same idea, this is probably the good algorithm. Expect this for 0.104.1 that should be released later this week. Yves --=20 - Homepage - http://ymettier.free.fr - http://www.logicacmg.com - - GPG key - http://ymettier.free.fr/gpg.txt - - Maitretarot - http://www.nongnu.org/maitretarot/ - - Perfparse - http://perfparse.sf.net/ - |