New upstream version 0.6.27
This commit is contained in:
25
contrib/fedora/logwatch/conf/logfiles/pnp4nagios.conf.in
Normal file
25
contrib/fedora/logwatch/conf/logfiles/pnp4nagios.conf.in
Normal file
@@ -0,0 +1,25 @@
|
||||
##########################################################################
|
||||
# $Id$
|
||||
##########################################################################
|
||||
|
||||
########################################################
|
||||
# This was written and is maintained by:
|
||||
# Chuck Lane <lane@dchooz.org>
|
||||
#
|
||||
########################################################
|
||||
|
||||
# What actual file? Defaults to LogPath if not absolute path....
|
||||
LogFile = @PERFDATA_LOG@
|
||||
Logfile = @logdir@/npcd.log
|
||||
|
||||
# If the archives are searched, here is one or more line
|
||||
# (optionally containing wildcards) that tell where they are...
|
||||
#If you use a "-" in naming add that as well -mgt
|
||||
Archive = @PERFDATA_LOG@?[0-9]+
|
||||
Archive = @PERFDATA_LOG@?[0-9]+.gz
|
||||
Archive = @logdir@/npcd.log.[0-9]+
|
||||
Archive = @logdir@/npcd.log.[0-9]+.gz
|
||||
|
||||
|
||||
*ApplyEuroDate =
|
||||
# vi: shiftwidth=3 tabstop=3 et
|
||||
21
contrib/fedora/logwatch/conf/services/pnp4nagios.conf
Normal file
21
contrib/fedora/logwatch/conf/services/pnp4nagios.conf
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
# You can put comments anywhere you want to. They are effective for the
|
||||
# rest of the line.
|
||||
|
||||
# this is in the format of <name> = <value>. Whitespace at the beginning
|
||||
# and end of the lines is removed. Whitespace before and after the = sign
|
||||
# is removed. Everything is case *insensitive*.
|
||||
|
||||
# Yes = True = On = 1
|
||||
# No = False = Off = 0
|
||||
|
||||
Title = pnp4nagios-messages
|
||||
|
||||
# Which logfile group...
|
||||
LogFile = pnp4nagios
|
||||
|
||||
# *OnlyService = vsftpd
|
||||
#*RemoveHeaders =
|
||||
|
||||
|
||||
# vi: shiftwidth=3 tabstop=3 et
|
||||
71
contrib/fedora/logwatch/scripts/services/pnp4nagios.in
Normal file
71
contrib/fedora/logwatch/scripts/services/pnp4nagios.in
Normal file
@@ -0,0 +1,71 @@
|
||||
#!@PERL@
|
||||
##########################################################################
|
||||
# $Id: $
|
||||
##########################################################################
|
||||
# $Log: $
|
||||
# Rev for pnp4nagios 0.6.26 2022/10/23 lane@dchooz.org
|
||||
##########################################################################
|
||||
|
||||
use strict;
|
||||
use Logwatch ':all';
|
||||
|
||||
my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
|
||||
my $DebugCounter = 0;
|
||||
|
||||
my @OtherList = ();
|
||||
|
||||
if ( $Debug >= 5 ) {
|
||||
print STDERR "\n\nDEBUG: Inside pnp4nagios Filter \n\n";
|
||||
$DebugCounter = 1;
|
||||
}
|
||||
|
||||
my $line = 0;
|
||||
#my $date = '\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \[\d+\] \[\d+\]';
|
||||
while (defined(my $ThisLine = <STDIN>)) {
|
||||
if ( $Debug >= 5 ) {
|
||||
print STDERR "DEBUG($DebugCounter): $ThisLine";
|
||||
$DebugCounter++;
|
||||
}
|
||||
chomp($ThisLine);
|
||||
$ThisLine =~ s/^File truncated// if $line == 0;
|
||||
$line++;
|
||||
|
||||
if (
|
||||
($ThisLine =~ /Found Performance Data for/) or
|
||||
($ThisLine =~ /\d+ lines processed/) or
|
||||
($ThisLine =~ /\/var\/spool\/pnp4nagios\/service-perfdata\.\d+-PID-\d+ deleted/) or
|
||||
($ThisLine =~ /\/var\/spool\/pnp4nagios\/host-perfdata\.\d+-PID-\d+ deleted/) or
|
||||
($ThisLine =~ /PNP exiting \(runtime/) or
|
||||
($ThisLine =~ /process_perfdata.pl-[\.\d]+ starting in BULK Mode called by (NPCD|Nagios)/) or
|
||||
($ThisLine =~ /process_perfdata.pl-[\.\d]+ starting in SYNC Mode/) or
|
||||
($ThisLine =~ /process_perfdata.pl-[\.\d]+ starting in STDIN Mode/) or
|
||||
($ThisLine =~ /NPCD: Found \d+ files in/) or
|
||||
($ThisLine =~ /NPCD: ThreadCounter \d+\/\d+ File is/) or
|
||||
($ThisLine =~ /NPCD: Regular File: (host|service)-perfdata\.\d+/) or
|
||||
($ThisLine =~ /NPCD: A thread was started on thread_counter = \d+/) or
|
||||
($ThisLine =~ /NPCD: Processing file (host|service)-perfdata\.\d+ with ID \d+ - going to exec/) or
|
||||
($ThisLine =~ /NPCD: Have to wait: Filecounter = \d+ - thread_counter = \d+/) or
|
||||
($ThisLine =~ /NPCD: No more files to process\.\.\. waiting for \d+ seconds/) or
|
||||
0 # this line prevents blame-shifting as lines are added above
|
||||
)
|
||||
{
|
||||
if ( $Debug >= 6 ) {
|
||||
print STDERR "DEBUG($DebugCounter): line ignored\n";
|
||||
}
|
||||
} else
|
||||
{
|
||||
# Report any unmatched entries...
|
||||
push @OtherList, "$ThisLine\n";
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################
|
||||
|
||||
if ($#OtherList >= 0) {
|
||||
print "\n**Unmatched Entries**\n";
|
||||
print @OtherList;
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
# vi: shiftwidth=3 tabstop=3 syntax=perl et
|
||||
17
contrib/fedora/npcd.service
Normal file
17
contrib/fedora/npcd.service
Normal file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=npcd rrd processor for pnp4nagios
|
||||
Documentation=http://docs.pnp4nagios.org/
|
||||
After=network.target local-fs.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=nagios
|
||||
Group=nagios
|
||||
PIDFile=/run/nagios/npcd.pid
|
||||
Environment="CONFIG_FILE=/etc/pnp4nagios/npcd.cfg"
|
||||
EnvironmentFile=-/etc/sysconfig/npcd
|
||||
ExecStart=/usr/sbin/npcd -d -f ${CONFIG_FILE}
|
||||
ExecStop=/bin/kill -s QUIT $MAINPID
|
||||
|
||||
[Install]
|
||||
WantedBy=nagios.service
|
||||
5
contrib/fedora/npcd.sysconfig
Normal file
5
contrib/fedora/npcd.sysconfig
Normal file
@@ -0,0 +1,5 @@
|
||||
#
|
||||
#
|
||||
# if the config file is in a different location, change it here
|
||||
#
|
||||
#CONFIG_FILE=/etc/pnp4nagios/npcd.cfg
|
||||
89
contrib/fedora/pnp4nagios-README.fedora
Normal file
89
contrib/fedora/pnp4nagios-README.fedora
Normal file
@@ -0,0 +1,89 @@
|
||||
(For Fedora and other redhat-ish variants)
|
||||
|
||||
**** httpd integration ****
|
||||
pnp4nagios.httpd.plugin.conf -> /etc/systemd/system/httpd.service.d/pnp4nagios.conf
|
||||
systemctl daemon-reload
|
||||
...this sets the XDG_CACHE_HOME environment variable needed by
|
||||
fontconfig that is in turn needed by rrdtool graph generation
|
||||
it should be an apache-writable directory, typically /var/cache/httpd
|
||||
|
||||
|
||||
**** nagios integration *****
|
||||
|
||||
|
||||
* Default Mode
|
||||
|
||||
/etc/nagios/nagios.cfg
|
||||
|
||||
process_performance_data=1
|
||||
service_perfdata_command=process-service-perfdata
|
||||
|
||||
/etc/nagios/commands.cfg
|
||||
|
||||
define command {
|
||||
command_name process-service-perfdata
|
||||
command_line /usr/bin/perl /usr/libexec/pnp4nagios/process_perfdata.pl
|
||||
}
|
||||
|
||||
define command {
|
||||
command_name process-host-perfdata
|
||||
command_line /usr/bin/perl /usr/libexec/pnp4nagios/process_perfdata.pl -d HOSTPERFDATA
|
||||
}
|
||||
|
||||
|
||||
* Bulk Mode
|
||||
|
||||
/etc/nagios/nagios.cfg :
|
||||
|
||||
process_performance_data=1
|
||||
#
|
||||
# service performance data
|
||||
#
|
||||
service_perfdata_file=/var/spool/nagios/service-perfdata
|
||||
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
|
||||
service_perfdata_file_mode=a
|
||||
service_perfdata_file_processing_interval=15
|
||||
service_perfdata_file_processing_command=process-service-perfdata-file
|
||||
|
||||
/etc/nagios/commands.cfg :
|
||||
|
||||
define command{
|
||||
command_name process-service-perfdata-file
|
||||
command_line $USER1$/process_perfdata.pl --bulk=/var/spool/nagios/service-perfdata
|
||||
}
|
||||
|
||||
define command{
|
||||
command_name process-host-perfdata-file
|
||||
command_line $USER1$/process_perfdata.pl --bulk=/var/spool/nagios/host-perfdata
|
||||
}
|
||||
|
||||
|
||||
* Bulk Mode with NPCD
|
||||
|
||||
npcd daemon needs to be started :
|
||||
service npcd start
|
||||
chkconfig npcd on
|
||||
|
||||
The configuration is identical to the bulk mode except for the used command.
|
||||
|
||||
/etc/nagios/commands.cfg :
|
||||
|
||||
define command{
|
||||
command_name process-service-perfdata-file
|
||||
command_line /bin/mv /var/spool/nagios/service-perfdata /var/spool/pnp4nagios/service-perfdata.$TIMET$
|
||||
}
|
||||
|
||||
define command{
|
||||
command_name process-host-perfdata-file
|
||||
command_line /bin/mv /var/spool/nagios/host-perfdata /var/spool/pnp4nagios/service-perfdata.$TIMET$
|
||||
}
|
||||
|
||||
|
||||
* Nagios integration
|
||||
|
||||
/etc/nagios/hostextinfo.cfg :
|
||||
|
||||
define hostextinfo {
|
||||
host_name localhost
|
||||
action_url /pnp4nagios/graph?host=$HOSTNAME$
|
||||
}
|
||||
103
contrib/fedora/pnp4nagios-npcd.sysvinit
Normal file
103
contrib/fedora/pnp4nagios-npcd.sysvinit
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# npcd Nagios Performancedata C Daemon
|
||||
#
|
||||
# chkconfig: - 98 02
|
||||
# description: Nagios Performancedata C Daemon
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides:
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start:
|
||||
# Default-Stop:
|
||||
# Short-Description:
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
exec="/usr/sbin/npcd"
|
||||
prog="npcd"
|
||||
config="/etc/pnp4nagios/npcd.cfg"
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
start() {
|
||||
[ -x $exec ] || exit 5
|
||||
[ -f $config ] || exit 6
|
||||
echo -n $"Starting $prog: "
|
||||
daemon $exec -f $config -d
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $prog
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
status $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
7
contrib/fedora/pnp4nagios.logrotate.conf.in
Normal file
7
contrib/fedora/pnp4nagios.logrotate.conf.in
Normal file
@@ -0,0 +1,7 @@
|
||||
@logdir@/*.log {
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
rotate 5
|
||||
size 100k
|
||||
}
|
||||
Reference in New Issue
Block a user