From: Tim W. <tim...@gm...> - 2005-02-10 13:17:10
|
You can update the perl script that nagios uses to write the data to the pipe (in your config this is /usr/local/nagios/bin/perfparse_nagios_command.pl), so that it will not write anything if the pipe does not exist. That way, you prohibit the script from creating it as a regular file if it doesn't exist yet. I believe this should do the trick. Tim. #! /usr/bin/perl -w use strict; my $file = shift @ARGV; exit(0) unless (-p $file); open FH, ">$file" or die "'$file' could not be opened for appending\n"; print FH join("\t", @ARGV); print FH "\n"; close FH; On Wed, 9 Feb 2005 17:42:14 -0800, Tong Young <To...@in...> wrote: > > I have read through the documentation and groups and got it working, but I > need to manually run ./perfparsed before the service-perfdata.log file is > created by nagios. Is this by design? > > Should I create some script to run perfparsed before nagios starts. Or did > I miss something that is suppose to run perfparsed by itself? Thanks! > > I am running Nagios 2.0 on debian sarge. Here are my config files: > > nagios_performance.cfg: > > define command{ > command_name process-service-perfdata > command_line /usr/local/nagios/bin/perfparse_nagios_command.pl > /usr/local/nagios/var/perfdata-service.log "$TIMET$" "$HOSTNAME$" > "$SERVICEDESC$" "$SERVICEOUTPUT$" "$SERVICESTATE$" "$SERVICEPERFDATA$" > } > > define command{ > command_name process-host-perfdata > command_line /usr/local/nagios/bin/perfparse_nagios_command.pl > /usr/local/nagios/var/var/perfdata-host.log "$TIMET$" "$HOSTNAME$" > "$OUTPUT$" "$PERFDATA$" > } > > perfparsed.cfg > > Perfparsed [options] > > # File where Perfparse logs messages > # Error_Log = "string" > Error_Log = "perfparse.log" > > # Rotate Perfparse log files > # Error_Log_Rotate = "Y/N" > Error_Log_Rotate = "Yes" > > # Keep N days of error log. Compress recent logs and remove too old ones > # Error_Log_Keep_N_Days = "value" > Error_Log_Keep_N_Days = "7" > > # When perfparse cannot parse a line, it drops it to that file > # Drop_File = "string" > Drop_File = "/tmp/perfparse.drop" > > # > # Drop_File_Rotate = "Y/N" > Drop_File_Rotate = "Yes" > > # Keep N days of drop file log. Compress recent logs and remove too old ones > # Drop_File_Keep_N_Days = "value" > Drop_File_Keep_N_Days = "7" > > # Port for perfparsed server > Put 0 or "" to disable the server > # Server_Port = "value" > Server_Port = "1976" > > # Log source from nagios (or other tools) that perfparse will scan > Authorized values: a file name, '-' for stdin, '|' for a fifo and '>' for a > host:port socket > For sockets, a command 'history' will be sent before retreiving the data > # Service_Log = "string" > Service_Log = "|/usr/local/nagios/var/perfdata-service.log" > > # Save the read position in the nagios log file ? If yes, perfparse will > start from that position instead of from the beginning > # Service_Log_Save_Position = "Y/N" > Service_Log_Save_Position = "yes" > > # Path for files containing the read position for nagios log files > # Service_Log_Position_Mark_Path = "string" > Service_Log_Position_Mark_Path = "/usr/local/nagios/var" > > # Lock file for perfparsed > # Daemon_Lock = "string" > Daemon_Lock = "/usr/local/nagios/var/perfparsed.lock" > > # Run perfparsed as a daemon > # Daemonize = "Y/N" > Daemonize = "no" > > # Perform some periodic cleanup every day > # Periodic_Cleanup = "Y/N" > Periodic_Cleanup = "yes" > > # Lock file for perfparsed periodic cleanup process > # Periodic_Cleanup_Lock = "string" > Periodic_Cleanup_Lock = > "/usr/local/nagios/var/perfparsed_periodic_cleanup.lock" > > # Perform some periodic cleanup every day at HHMM > # Periodic_Cleanup_Hour = "value" > Periodic_Cleanup_Hour = "0230" > > # Dummy hostname if gethostname() does not work > # Dummy_Hostname = "string" > Dummy_Hostname = "dummy" > > # Don't store raw data > # No_Raw_Data = "Y/N" > No_Raw_Data = "no" > > # Don't store bin data > # No_Bin_Data = "Y/N" > No_Bin_Data = "no" > > # Path where storage modules are > # Storage_Modules_Dir = "string" > Storage_Modules_Dir = "/usr/local/nagios/lib" > > # Modules to load (Coma separated values) > # Storage_Modules_Load = "string" > Storage_Modules_Load = "mysql" > > # File to contain Storage Modules Status > # Storage_Modules_Status_File = "string" > Storage_Modules_Status_File = "/usr/local/nagios/var/storage_modules.status" > > > > # Storage Module : mysql > # ============================== > > # Database user > # DB_User = "string" > DB_User = "-removed-" > > # Database password > # DB_Pass = "string" > DB_Pass = "-removed-" > > # Database name > # DB_Name = "string" > DB_Name = "-removed-" > > # Database hostname > # DB_Host = "string" > DB_Host = "localhost" > > > > > > |