From: Roberto R. <Rob...@en...> - 2006-05-15 10:05:45
|
Q: what method are you using? http://perfparse.sourceforge.net/docs.php A: I think the method used be the sequent:=20 Nagios Invokes Perfparse Description: When you compile Nagios, don't specify --with-file-perfdata but = --with-default-perfdata. Then create a Nagios command to run=20 perfparse-log2mysql every time a log is generated.=20 We defined a shell script wich read from a file and send a kill signal = to nagios to reset its log. This is the content of the script executed = in crontab every 10 minutes: perfparse.sh *************************************************************************= #!/bin/sh CONFIG_FILE=3D"/usr/local/nagios/etc/perfparse.cfg" PERFPARSE=3D"/usr/local/nagios/bin/perfparse-log2mysql" NAGIOS_LOCK_FILE=3D"/usr/local/nagios/var/nagios.lock" ERROR_LOG=3D`egrep "^Error_Log *=3D" ${CONFIG_FILE} | sed -e = 's/^Error_Log *=3D *"\(.*\)".*$/\1/'` PERF_FILE=3D`egrep "^Service_Log = *=3D" ${CONFIG_FILE} | sed -e 's/^Service_Log *=3D *"\(.*\)".*$/\1/'` = TMP_ERR=3D/tmp/perfparse.err.$$ if [ ! -f $ERROR_LOG ] ; then echo Error_Log undefined in ${CONFIG_FILE} echo Cannot continue exit 1 fi if [ ! -f $PERF_FILE ] ; then exit fi if [ "x${NAGIOS_LOCK_FILE}" =3D "x" ] ; then echo "No Nagios Lock file defined." exit 1 fi if [ ! -f $NAGIOS_LOCK_FILE ] ; then NAGIOS_LOCK=3D else NAGIOS_LOCK=3D`cat ${NAGIOS_LOCK_FILE}` fi # Run: mv ${PERF_FILE} ${PERF_FILE}1 if [ "x$NAGIOS_LOCK" !=3D "x" ] ; then kill -1 $NAGIOS_LOCK fi cat ${PERF_FILE}1 |${PERFPARSE} --serviceperf-log - -c ${CONFIG_FILE} 2> = ${TMP_ERR} RETURN=3D$? rm ${PERF_FILE}1 # Did run? case ${RETURN} in 0) # Completed successfully. if [ -f ${TMP_ERR} ] ; then cat ${TMP_ERR} >> ${ERROR_LOG} ; fi ;; 120) # Another copy running if [ -f ${TMP_ERR} ] ; then cat ${TMP_ERR} >> ${ERROR_LOG} ; fi ;; *) # Error # Let this be picked up by cron and emailed # to default administrator if [ -f ${TMP_ERR} ] ; then cat ${TMP_ERR} >> ${ERROR_LOG} ; fi ;; esac if [ -f ${TMP_ERR} ] ; then rm ${TMP_ERR} 2> /dev/null ; fi exit *************************************************************************= This is the pertinent content of the config file nagios.cfg=20 *************************************************************************= cfg_file=3D/usr/local/nagios/etc/nagios_perfparse.cfg xpdfile_host_perfdata_file=3D/usr/local/nagios/var/perfdata-host.log xpdfile_host_perfdata_template=3D$TIMET$\t$HOSTNAME$\t$OUTPUT$\t$PERFDATA= $ xpdfile_service_perfdata_file=3D/usr/local/nagios/var/perfdata-service.lo= g xpdfile_service_perfdata_template=3D$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$= OUTPUT$\t$SERVICESTATE$\t$PERFDATA$ perfdata_timeout=3D5 process_performance_data=3D1 = host_perfdata_command=3Dprocess-host-perfdata service_perfdata_command=3Dprocess-service-perfdata # host_perfdata_file=3D = service_perfdata_file=3D/usr/local/nagios/var/perfdata.log # host_perfdata_file_template=3D = service_perfdata_file_template=3D$LASTSERVICECHECK$||$HOSTNAME$||$SERVICE= DESC$||$SERVICEOUTPUT$||$SERVICESPERDATA$ # host_perfdata_file_mode=3D service_perfdata_file_mode=3Da # host_perfdata_file_processing_interval=3D service_perfdata_file_processing_interval=3D30 # host_perfdata_file_processing_command=3D service_perfdata_file_processing_command=3Dprocess-service-perfdata ************************************* And this is the content of the config file perfparse.cfg *************************************************************************= * Error_Log =3D "/usr/local/nagios/var/perfparse.log" Error_Log_Rotate =3D "yes" Error_Log_Keep_N_Days =3D "7" Drop_File =3D "/usr/local/nagios/var/perfparse.drop" Drop_File_Rotate =3D "yes" Drop_File_Keep_N_Days =3D "7" Server_Port =3D "1976" Service_Log =3D "/usr/local/nagios/var/perfdata-service.log" Service_Log_Save_Position =3D "yes" Service_Log_Position_Mark_Path =3D = "/usr/local/nagios/var" Daemon_Lock =3D = "/usr/local/nagios//var/perfparsed.lock" Daemonize =3D "no" Periodic_Cleanup =3D "yes" Periodic_Cleanup_Lock =3D = "/usr/local/nagios//var/perfparsed_periodic_cleanup.lock" Periodic_Cleanup_Hour =3D "0230" Dummy_Hostname =3D "LinuxSAM" No_Raw_Data =3D "no" No_Bin_Data =3D "no" Storage_Modules_Dir =3D "/usr/local/nagios//lib" Storage_Modules_Load = =3D "mysql" Storage_Modules_Status_File =3D = "/usr/local/nagios/var/storage_modules.status" # 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 DB_User =3D "nagios" DB_Pass =3D "" DB_Name =3D "nagios" DB_Host =3D "LinuxSAM" *************************************************************************= Q: how is your process-service-perfdata command defined? A: this is the content of the config file nagios_perfparse.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$"=20 "$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/perfdata-host.log "$TIMET$"=20 "$HOSTNAME$" "$HOSTOUTPUT$" "$HOSTPERFDATA$" } =20 Roberto Raffo=20 Digital Solution Center System & Application Management ---------------------------------------- Via Galbani, n=B0 55 00156 - Roma Phone +39 06 7202 0337 Mobile +39 320 4080151 Fax +39 06 7202 8020 www.enterpriseda.com=20 =20 "Il presente messaggio e gli eventuali allegati sono di natura = confidenziale.=20 Qualora vi fosse pervenuto per errore, vi preghiamo di cancellarlo immediatamente dal vostro sistema e di avvisare il mittente. Grazie." =20 "This electronic mail transmission and any accompanying attachments = contain confidential information. If you have received this communication in = error, please immediately delete the E-mail and either notify the sender. Thank = you." =20 =20 >>-----Original Message----- >>From: per...@li... = [mailto:perfparse-users- >>ad...@li...] On Behalf Of Florian Gleixner >>Sent: venerd=EC 12 maggio 2006 23.45 >>To: per...@li... >>Subject: Re: [Perfparse-users] Nagios and Perfparse integration = problem >> >>Hi, >> >>what method are you using? >>http://perfparse.sourceforge.net/docs.php >>how is your process-service-perfdata command defined? >> >>Flo >> >>Roberto Raffo schrieb: >>> >>> >>> >>> >>> Hi folks! >>> >>> We use Nagios to monitor approximately 120 hosts with a total of 400 >>> checks. >>> >>> This worked fine but when we have installed perfparse many checks = appear >>> to have problems. >>> >>> In some cases they are rescheduled without produce output. In other >>> cases they simply do not work without even be rescheduled. >>> >>> Only a few checks go on working correctly, but, after a few hours, = all >>> the ckecks appear to stop working and rescheduling. >>> >>> The worse thing is that no error message is recorded on the event = log. >>> >>> >>> >>> Other informations: >>> >>> - We use Nagios 2.1 and Perfparse 0.105.6. >>> >>> - Perfparse is scheduled in crontab every 10 minutes. >>> >>> >>> >>> Any ideas? >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> * Roberto Raffo * >>> >>> Application & Service Providing >>> >>> ---------------------------------------- >>> >>> Via Galbani, n=B0 55 00156 - Roma >>> >>> rob...@en... >>> >>> www.enterpriseda.com <http://www.enterpriseda.com/> >>> >>> >>> >> >> >>------------------------------------------------------- >>Using Tomcat but need to do more? Need to support web services, = security? >>Get stuff done quickly with pre-integrated technology to make your job >>easier >>Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo >>http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=120709&bid&3057&dat=121642 >>_______________________________________________ >>Perfparse-users mailing list >>Per...@li... >>https://lists.sourceforge.net/lists/listinfo/perfparse-users |