From: Tong Y. <To...@in...> - 2005-02-10 01:42:32
|
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? =20 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! =20 I am running Nagios 2.0 on debian sarge. Here are my config files: =20 nagios_performance.cfg: =20 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$" } =20 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$" } =20 perfparsed.cfg =20 Perfparsed [options] =20 # File where Perfparse logs messages # Error_Log =3D "string" Error_Log =3D "perfparse.log" =20 # Rotate Perfparse log files # Error_Log_Rotate =3D "Y/N" Error_Log_Rotate =3D "Yes" =20 # Keep N days of error log. Compress recent logs and remove too old ones # Error_Log_Keep_N_Days =3D "value" Error_Log_Keep_N_Days =3D "7" =20 # When perfparse cannot parse a line, it drops it to that file # Drop_File =3D "string" Drop_File =3D "/tmp/perfparse.drop" =20 #=20 # Drop_File_Rotate =3D "Y/N" Drop_File_Rotate =3D "Yes" =20 # Keep N days of drop file log. Compress recent logs and remove too old ones # Drop_File_Keep_N_Days =3D "value" Drop_File_Keep_N_Days =3D "7" =20 # Port for perfparsed server Put 0 or "" to disable the server # Server_Port =3D "value" Server_Port =3D "1976" =20 # 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 =3D "string" Service_Log =3D "|/usr/local/nagios/var/perfdata-service.log" =20 # 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 =3D "Y/N" Service_Log_Save_Position =3D "yes" =20 # Path for files containing the read position for nagios log files # Service_Log_Position_Mark_Path =3D "string" Service_Log_Position_Mark_Path =3D "/usr/local/nagios/var" =20 # Lock file for perfparsed # Daemon_Lock =3D "string" Daemon_Lock =3D "/usr/local/nagios/var/perfparsed.lock" =20 # Run perfparsed as a daemon # Daemonize =3D "Y/N" Daemonize =3D "no" =20 # Perform some periodic cleanup every day # Periodic_Cleanup =3D "Y/N" Periodic_Cleanup =3D "yes" =20 # Lock file for perfparsed periodic cleanup process # Periodic_Cleanup_Lock =3D "string" Periodic_Cleanup_Lock =3D "/usr/local/nagios/var/perfparsed_periodic_cleanup.lock" =20 # Perform some periodic cleanup every day at HHMM # Periodic_Cleanup_Hour =3D "value" Periodic_Cleanup_Hour =3D "0230" =20 # Dummy hostname if gethostname() does not work # Dummy_Hostname =3D "string" Dummy_Hostname =3D "dummy" =20 # Don't store raw data # No_Raw_Data =3D "Y/N" No_Raw_Data =3D "no" =20 # Don't store bin data # No_Bin_Data =3D "Y/N" No_Bin_Data =3D "no" =20 # Path where storage modules are # Storage_Modules_Dir =3D "string" Storage_Modules_Dir =3D "/usr/local/nagios/lib" =20 # Modules to load (Coma separated values) # Storage_Modules_Load =3D "string" Storage_Modules_Load =3D "mysql" =20 # File to contain Storage Modules Status # Storage_Modules_Status_File =3D "string" Storage_Modules_Status_File =3D "/usr/local/nagios/var/storage_modules.status" =20 =20 =20 # Storage Module : mysql # = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D =20 # Database user # DB_User =3D "string" DB_User =3D "-removed-" =20 # Database password # DB_Pass =3D "string" DB_Pass =3D "-removed-" =20 # Database name # DB_Name =3D "string" DB_Name =3D "-removed-" =20 # Database hostname # DB_Host =3D "string" DB_Host =3D "localhost" =20 =20 =20 =20 =20 =20 |
From: Yves <yme...@pe...> - 2005-02-10 08:50:56
|
> I have read through the documentation and groups and got it working, bu= t > I need to manually run ./perfparsed before the service-perfdata.log fil= e > is created by nagios. Is this by design? If you are running nagios-1.2, yes, this is by design. Perfparsed reads from a pipe, and creates it if necessary. If you run nag= ios-1.2 before, it will write to whatever the file is, and if it does not exist, write a = new file. If the design was to run perfparsed after nagios, you would loose the dat= a written in that file, or have perfparsed block because of that regular file. 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://www.perfparse.org/ - |
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" > > > > > > |