debian/0000755000000000000000000000000011770650342007173 5ustar debian/source/0000755000000000000000000000000011567237567010511 5ustar debian/source/format0000644000000000000000000000001411567237567011717 0ustar 3.0 (quilt) debian/changelog0000644000000000000000000000142011770647547011057 0ustar nagircbot (0.0.33-2) unstable; urgency=low * Bump Standards-Version to 3.9.3 (no changes necessary). * Really disable the debug build option this time. * Avoid hard coded PID file path in init script. * Use official/non-DEP URL for machine-readable debian/copyright. -- John Morrissey Thu, 21 Jun 2012 11:26:51 -0400 nagircbot (0.0.33-1) unstable; urgency=low * New upstream version. * Disable upstream's debug build option (20fix-non-debug-build), avoiding excessive CPU consumption in its memory allocation tracking code. -- John Morrissey Wed, 25 May 2011 13:29:31 -0400 nagircbot (0.0.32-1) unstable; urgency=low * Initial release. (Closes: #546481) -- John Morrissey Mon, 13 Dec 2010 09:03:32 -0500 debian/dirs0000644000000000000000000000001011567237567010064 0ustar usr/bin debian/default0000644000000000000000000000062111567237567010557 0ustar # Run nagircbot on system startup? ENABLE=no # Location of Nagios/Icinga's status.dat. STATUSFILE=/var/cache/nagios3/status.dat # User to run as. USER=nagios # IRC server and port to connect to. SERVER=irc.example.com:6667 # IRC nickname to use. NICK=nagircbot # IRC channel to connect to, including the leading "#". CHANNEL='#mychannel' # Additonal arguments (see nagircbot man page). OPTIONS= debian/postrm0000755000000000000000000000031711567237567010464 0ustar #!/bin/sh set -e case "$1" in purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/docs0000644000000000000000000000001311567237567010056 0ustar readme.txt debian/control0000644000000000000000000000137211770637263010610 0ustar Source: nagircbot Section: net Priority: extra Maintainer: Debian Nagios Maintainer Group Uploaders: John Morrissey Build-Depends: debhelper (>= 7), libssl-dev Standards-Version: 3.9.3 Homepage: http://www.vanheusden.com/nagircbot/ Package: nagircbot Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: IRC bot that announces Nagios status An IRC (Internet Relay Chat) bot that reads Nagios' status information and emits alerts to an IRC channel. It can filter alerts based on severity (CRITICAL, HARD, SOFT, and/or UNKNOWN) or by regular expression. It can connect to IRC servers protected by password or SSL, and can optionally set the topic to the current Nagios status. debian/compat0000644000000000000000000000000211567237567010407 0ustar 7 debian/postinst0000755000000000000000000000022111567237567011015 0ustar #!/bin/sh set -e case "$1" in configure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/rules0000755000000000000000000000010011567237567010260 0ustar #!/usr/bin/make -f #export DH_VERBOSE=1 %: prefix=/usr dh $@ debian/patches/0000755000000000000000000000000011770647764010640 5ustar debian/patches/10add-destdir-support0000644000000000000000000000212611567240117014604 0ustar Description: Add DESTDIR support to the upstream build Author: John Morrissey Forwarded: <20101217190359.GA25969@boost.horde.net> Last-Update: 2010-12-13 --- nagircbot-0.0.32.orig/Makefile +++ nagircbot-0.0.32/Makefile @@ -2,12 +2,16 @@ VERSION=0.0.33 -DEBUG= -g -D_DEBUG #-fprofile-arcs -ftest-coverage # -pg -g -CXXFLAGS+=-Wall -O2 -DVERSION=\"${VERSION}\" $(DEBUG) -CFLAGS+=${CXXFLAGS} -LDFLAGS+=$(DEBUG) -lcrypto -lssl -lstdc++ +DEBUG=-g -D_DEBUG #-fprofile-arcs -ftest-coverage #-pg -g +CXXFLAGS += -Wall -O2 -DVERSION=\"${VERSION}\" $(DEBUG) +CFLAGS += ${CXXFLAGS} +LDFLAGS += $(DEBUG) -lcrypto -lssl -lstdc++ + +DESTDIR ?= +prefix ?= /usr/local +bindir ?= $(prefix)/bin -OBJS= ssl.o error.o log.o utils.o br.o pl.o anna.o +OBJS=ssl.o error.o log.o utils.o br.o pl.o anna.o all: nagircbot @@ -15,7 +19,8 @@ nagircbot: $(OBJS) $(CC) -Wall -W $(OBJS) $(LDFLAGS) -o nagircbot install: nagircbot - cp nagircbot /usr/local/bin + cp nagircbot $(DESTDIR)$(bindir)/nagircbot + chmod 0755 $(DESTDIR)$(bindir)/nagircbot clean: rm -f $(OBJS) nagircbot core *.da *.gcov *.bb* debian/patches/20fix-non-debug-build0000644000000000000000000000076411567237567014473 0ustar Description: Fix non-debug builds (i.e., when _DEBUG isn't defined) Author: John Morrissey Forwarded: <20110316160729.GA28881@boost.horde.net> Last-Update: 2011-03-16 diff --git a/anna.cpp b/anna.cpp index a05e1e4..be60c01 100644 --- a/anna.cpp +++ b/anna.cpp @@ -320,8 +320,8 @@ int check_nagios_status(server_t server_conn) int n_cur = 0; int loop; int any_shown = 0; -#ifdef _DEBUG time_t now = time(NULL); +#ifdef _DEBUG printf("Checking @ %s", ctime(&now)); #endif debian/patches/21non-debug-build0000644000000000000000000000110111770647763013671 0ustar Description: Disable debug build to avoid excessive CPU consumption in the debug build's memory allocation tracking code. Author: John Morrissey Last-Update: 2012-06-21 --- nagircbot-0.0.33.orig/Makefile +++ nagircbot-0.0.33/Makefile @@ -2,7 +2,7 @@ VERSION=0.0.33 -DEBUG=-g -D_DEBUG #-fprofile-arcs -ftest-coverage #-pg -g +DEBUG=-g #-D_DEBUG -fprofile-arcs -ftest-coverage #-pg -g CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS) CXXFLAGS += -Wall -O2 -DVERSION=\"${VERSION}\" $(DEBUG) CFLAGS += ${CXXFLAGS} $(shell dpkg-buildflags --get CFLAGS) debian/patches/11hardening-flags0000644000000000000000000000155711770647646013765 0ustar Description: Enable hardening flags (http://wiki.debian.org/Hardening) Author: John Morrissey Last-Update: 2012-06-21 Index: nagircbot-0.0.33/Makefile =================================================================== --- nagircbot-0.0.33.orig/Makefile 2012-06-21 15:48:16.000000000 +0000 +++ nagircbot-0.0.33/Makefile 2012-06-21 15:53:53.000000000 +0000 @@ -3,9 +3,11 @@ VERSION=0.0.33 DEBUG=-g -D_DEBUG #-fprofile-arcs -ftest-coverage #-pg -g +CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS) CXXFLAGS += -Wall -O2 -DVERSION=\"${VERSION}\" $(DEBUG) -CFLAGS += ${CXXFLAGS} -LDFLAGS += $(DEBUG) -lcrypto -lssl -lstdc++ +CFLAGS += ${CXXFLAGS} $(shell dpkg-buildflags --get CFLAGS) +CXXFLAGS += $(shell dpkg-buildflags --get CXXFLAGS) +LDFLAGS += $(DEBUG) -lcrypto -lssl -lstdc++ $(shell dpkg-buildflags --get LDFLAGS) DESTDIR ?= prefix ?= /usr/local debian/patches/series0000644000000000000000000000012011770647615012041 0ustar 10add-destdir-support 11hardening-flags 20fix-non-debug-build 21non-debug-build debian/nagircbot.10000644000000000000000000000637711567237567011260 0ustar .TH NAGIRCBOT 1 "December 13, 2010" .\" Please adjust this date whenever revising the manpage. .SH NAME nagircbot \- announce Nagios status to an IRC channel .SH SYNOPSIS .SY nagircbot .OP \-CdeHmRStxX .OP \-A REGEX .OP \-c CHANNEL .OP \-f FILE .OP \-F HOST[:PORT] .OP \-i INTERVAL .OP \-I INTERVAL .OP \-k KEYWORD .OP \-n NICK .OP \-N PREFIX .OP \-p PASSWORD .OP \-P FILE .OP \-s HOST[:PORT] .OP \-T LIST .OP \-u USERNAME .OP \-U NAME .OP \-z USER .br .SH DESCRIPTION .PP \fBnagircbot\fP is an IRC bot that reads Nagios' status information and emits alerts to an IRC channel. It can filter alerts based on severity (\fBCRITICAL\fP, \fBHARD\fP, \fBSOFT\fP, and/or \fBUNKNOWN\fP) or by regular expression. It can connect to IRC servers protected by password or SSL, and can optionally set the topic to the current Nagios status. .SH OPTIONS .TP .B \-A REGEX Filter (omit) lines that match a basic regular expression. .TP .B \-c CHANNEL Channel to connect to, including the leading "#" (default: "#nagircbot"). .TP .B \-C Use colors in IRC messages. .TP .B \-d Do not fork into the background. .TP .B \-e Use encryption (SSL) when connecting to the IRC server. .TP .B \-f FILE Path to Nagios' status.log, indicated by the 'status_file' parameter in nagios.cfg (default: "/usr/local/nagios/var/status.log"). .TP .B \-F HOST[:PORT] Retrieve status.log over the network. If no port is specified, the default is 33333. .TP .B \-H Only announce alerts in 'HARD' state. This is the default. .TP .B \-i INTERVAL Nagios alert check interval, in seconds (default: 60). .TP .B \-I INTERVAL How often to announce Nagios global status in the channel, in seconds. Specify an interval of 0 (the default) to disable. Do not specify an interval smaller than the alert check (\-i) interval. .TP .B \-k KEYWORD Keyword for the channel (default: no keyword). .TP .B \-m Display status information for an alert in separate IRC messages instead of combining on a single message. .TP .B \-n NICK IRC nick to use (default: "nagircbot"). .TP .B \-N PREFIX Prefix for all in-channel IRC messages. .TP .B \-p PASSWORD IRC server password. .TP .B \-P FILE Write PID file. .TP .B \-R Only announce CRITICAL/UNKNOWN alerts. .TP .B \-s HOST[:PORT] IRC server to connect to. If not specified, the default is "localhost:6667". If no port is specified, the default is 33333. .TP .B \-S Also announce alerts in 'SOFT' state. .TP .B \-t Set the channel topic to an alert summary. .TP .B \-T LIST Enable checks to see if Nagios is still running. Send 'check' in a private message to invoke the check. Accepts a comma-seperated list (without spaces) with the following elements: max_time_last_host_update, max_time_oldest_host_update, max_time_last_host_check, max_time_oldest_host_check, max_time_last_service_check, max_time_oldest_service_check, and max_time_oldest_next_service_check. .TP .B \-u USERNAME Username to log into the IRC server as. .TP .B \-U NAME IRC "real" or full name (default: "nagircbot"). .TP .B \-x status.log is in Nagios 1.0 format. .TP .B \-X status.log is in Nagios 2.0/3.0 format. This is the default. .TP .B \-z USER User to run as. .SH AUTHOR nagircbot was written by Folkert van Heusden . .PP This manual page was written by John Morrissey , for the Debian project (and may be used by others). debian/init.d0000644000000000000000000001433511770636464010322 0ustar #!/bin/sh # Example init.d script with LSB support. # http://refspecs.freestandards.org/LSB_2.1.0/LSB-generic/LSB-generic/iniscrptact.html # # Please read this init.d carefully and modify the sections to # adjust it to the program you want to run. # # Copyright (c) 2007 Javier Fernandez-Sanguino # Copyright (c) 2010 John Morrissey # # This is free software; you may redistribute it and/or modify # it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2, # or (at your option) any later version. # # This is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License with # the Debian operating system, in /usr/share/common-licenses/GPL; if # not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA ### BEGIN INIT INFO # Provides: nagircbot # Required-Start: $network $remote_fs # Required-Stop: $network $remote_fs # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: IRC bot that announces Nagios status # Description: An IRC bot that reads Nagios' status information and # emits alerts to an IRC channel. It can filter alerts # based on severity (CRITICAL, HARD, SOFT, and/or # UNKNOWN) or by regular expression. It can connect to # IRC servers protected by password or SSL, and can # optionally set the topic to the current Nagios status. ### END INIT INFO DAEMON=/usr/bin/nagircbot NAME=nagircbot DESC=nagircbot PIDFILE=/var/run/$NAME.pid if [ ! -x "$DAEMON" ]; then exit 0 fi . /lib/lsb/init-functions # How long to wait for the server to start, in seconds. # If set, each time the server is started (on start or restart), # wait to see if it starts successfully. If not set and the # daemon takes a while to write its pid file, we might incorrectly # state that the daemon did not start up. # This value should always be at least 1. STARTTIME=1 # How long to wait for the server to stop, in seconds. # If set too low, some daemons may not stop gracefully # and 'restart' will not work. # This value should always be at least 1. DIETIME=1 # Include defaults if available if [ -f "/etc/default/$NAME" ]; then . "/etc/default/$NAME" fi # Check if pid's cmdline matches a given name. running_pid() { local pid=$1 shift local name=$1 shift if [ -z "$pid" ]; then return 1 fi if [ ! -d "/proc/$pid" ]; then return 1 fi cmd=$(cat "/proc/$pid/cmdline" | tr "\000" "\n" | head -n1 | cut -d: -f1) # Is this the expected server? if [ "$cmd" != "$name" ]; then return 1 fi return 0 } running() { local pid # No pidfile, probably no daemon present. if [ ! -f "$PIDFILE" ]; then return 1 fi pid=$(cat "$PIDFILE") if ! running_pid "$pid" "$DAEMON"; then return 1 fi return 0 } start_server() { start_daemon -p "$PIDFILE" "$DAEMON" -P "$PIDFILE" \ -z "$USER" -Xf "$STATUSFILE" \ -s "$SERVER" -n "$NICK" -c "$CHANNEL" $OPTIONS } stop_server() { killproc -p "$PIDFILE" "$DAEMON" } reload_server() { if [ ! -f "$PIDFILE" ]; then return 1 fi pid=$(pidofproc "$PIDFILE") kill -HUP $pid return } # Force the process to die. SIGTERM it at first, # then SIGKILL after $DIETIME. force_stop() { if [ ! -e "$PIDFILE" ]; then return 0 fi if ! running; then rm -f "$PIDFILE" return 0 fi kill -TERM "$pid" if ! running; then rm -f "$PIDFILE" return fi sleep "${DIETIME:-1}" kill -KILL $pid sleep "${DIETIME:-1}" if ! running; then rm -f "$PIDFILE" return fi echo "Cannot kill $NAME (pid=$pid)!" return 1 } case "$1" in start) case $ENABLE in [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]) exit 0 ;; esac log_daemon_msg "Starting $DESC " "$NAME" if running; then log_progress_msg "already running" log_end_msg 0 exit fi if ! start_server; then log_end_msg 1 exit fi if ! running; then sleep "${STARTTIME:-1}" fi if ! running; then log_end_msg 7 exit fi log_end_msg 0 exit ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if ! running; then log_progress_msg "not running" log_end_msg 0 exit fi stop_server log_end_msg $? exit ;; force-stop) # First, try to gracefully stop the program. "$0" stop if ! running; then exit 0 fi # It's still running; try to kill it more forcefully. log_daemon_msg "Stopping (force) $DESC" "$NAME" force_stop log_end_msg $? exit ;; restart|force-reload) case $ENABLE in [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]) exit 0 ;; esac log_daemon_msg "Restarting $DESC" "$NAME" if ! running; then log_end_msg 0 exit fi stop_server status=$? if [ $status -ne 0 ]; then if [ "$1" = 'force-reload' ]; then log_end_msg 0 else log_end_msg $status fi exit fi # Some servers take time to stop. sleep "${DIETIME:-1}" start_server status=$? if [ $status -ne 0 ]; then if [ "$1" = "force-reload" ]; then log_end_msg 0 else log_end_msg $status fi exit fi sleep "${STARTTIME:-1}" if ! running; then if [ "$1" = "force-reload" ]; then log_end_msg 0 else log_end_msg 7 fi exit fi log_end_msg 0 exit ;; status) status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" exit ;; # Use this if the daemon cannot reload... reload) log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon" log_warning_msg "cannot re-read the config file (use restart)." exit 3 ;; # ... and this if it can. #reload) # If the daemon can reload its config files on the fly # (for example, by sending it SIGHUP): #log_daemon_msg "Reloading $DESC configuration" "$NAME" #if ! running; then # log_progress_msg "not running" # log_end_msg 7 # exit #fi # #reload_server #if ! running; then # log_progress_msg "died on reload" # log_end_msg 1 # exit #fi #exit 0 #;; # If the daemon responds to changes in its config file # automatically, make this a do-nothing entry: #exit 0 #;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 exit 3 ;; esac exit 0 debian/manpages0000644000000000000000000000002311567237567010722 0ustar debian/nagircbot.1 debian/copyright0000644000000000000000000000051211770637362011133 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Contact: Folkert van Heusden Source: http://www.vanheusden.com/nagircbot/ Files: * Copyright: 2006-2010 Folkert van Heusden License: GPL-2 with OpenSSL exception /usr/share/common-licenses/GPL-2 debian/watch0000644000000000000000000000010311567237567010234 0ustar version=3 http://www.vanheusden.com/nagircbot/ nagircbot-(.*)\.tgz