aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--debian/changelog1
-rwxr-xr-xdebian/sitesummary.cron.daily30
-rw-r--r--debian/sitesummary.install1
-rw-r--r--nagios-templates.cfg123
-rw-r--r--nagios.cfg59
6 files changed, 219 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 1d6c746..e550507 100644
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,12 @@ install-server:
$(INSTALL) -d $(DESTDIR)/usr/share/munin/plugins/.
$(INSTALL) munin-plugin $(DESTDIR)/usr/share/munin/plugins/sitesummary_sites
+ $(INSTALL) -d $(DESTDIR)/etc/nagios3
+ $(INSTALL) nagios.cfg \
+ $(DESTDIR)/etc/nagios3/sitesummary.cfg
+ $(INSTALL) nagios-templates.cfg \
+ $(DESTDIR)/etc/nagios3/sitesummary-templates.cfg
+
install-client:
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) sitesummary-client sitesummary-upload $(DESTDIR)$(sbindir)
diff --git a/debian/changelog b/debian/changelog
index bdadf3f..b3aa29d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ sitesummary (0.0.51) UNRELASED; urgency=low
* Make sure the generated Nagios host entries uses a template.
* Make sure cron job exit imediately and without an error code if
the sitesummary package is removed but not purged (Closes: #563066).
+ * Implement draft Nagios autoconfiguration.
-- Finn-Arne Johansen <finnarne@debian> Wed, 18 Nov 2009 08:21:12 +0100
diff --git a/debian/sitesummary.cron.daily b/debian/sitesummary.cron.daily
index 9f0c5b6..777ef03 100755
--- a/debian/sitesummary.cron.daily
+++ b/debian/sitesummary.cron.daily
@@ -12,6 +12,12 @@ nodes=/usr/sbin/sitesummary-nodes
# the default munin configuration.
MUNINDIR=/var/lib/sitesummary
+# Specifies where to save the automatically generated nagios
+# configuration. Add NAGIOSCFG="/etc/nagios3/sitesummary.cfg" to
+# /etc/default/nagios3 toget Nagios to use this automatically
+# generated configuration
+NAGIOSDIR=/var/lib/sitesummary
+
[ -f /etc/sitesummary/collector.cfg ] && . /etc/sitesummary/collector.cfg
# Exit imediately if the package is removed but nor purged
@@ -66,11 +72,33 @@ EOF
mv $MUNINDIR/munin.conf.new $MUNINDIR/munin.conf
}
-# Only enable if munin is installed.
+generate_nagios_config() {
+ (
+ printf "# Generated "; date
+
+ sitesummary-nodes -n
+
+ if [ -f $NAGIOSDIR/nagios-generated.cfg.post ] ; then
+ cat $NAGIOSDIR/nagios-generated.cfg.post
+ fi
+
+ true
+ ) > $NAGIOSDIR/nagios-generated.cfg.new && \
+ chmod a+r $NAGIOSDIR/nagios-generated.cfg.new && \
+ mv $NAGIOSDIR/nagios-generated.cfg.new $NAGIOSDIR/nagios-generated.cfg
+}
+
+# Only enable if munin and sitesummary is installed.
if [ -f /etc/munin/munin.conf ] && [ -x /usr/sbin/sitesummary-nodes ]; then
generate_munin_config
fi
+# Only enable if nagios v3 and sitesummary is installed.
+if [ -f /etc/init.d/nagios3 ] && [ -x /usr/sbin/sitesummary-nodes ]; then
+ generate_nagios_config
+ invoke-rc.d nagios3 reload
+fi
+
[ -d $entriesdir ] && remove_old_entries
# Update the web report once a day
diff --git a/debian/sitesummary.install b/debian/sitesummary.install
index 60673d2..1d9d629 100644
--- a/debian/sitesummary.install
+++ b/debian/sitesummary.install
@@ -1,4 +1,5 @@
debian/tmp/etc/apache2
+debian/tmp/etc/nagios3
debian/tmp/usr/lib/cgi-bin
debian/tmp/usr/lib/sitesummary/*-summary
debian/tmp/usr/sbin/sitesummary-makewebreport
diff --git a/nagios-templates.cfg b/nagios-templates.cfg
new file mode 100644
index 0000000..eafcd74
--- /dev/null
+++ b/nagios-templates.cfg
@@ -0,0 +1,123 @@
+define timeperiod {
+ timeperiod_name 24x7
+ alias 24 Hours A Day, 7 Days A Week
+ sunday 00:00-24:00
+ monday 00:00-24:00
+ tuesday 00:00-24:00
+ wednesday 00:00-24:00
+ thursday 00:00-24:00
+ friday 00:00-24:00
+ saturday 00:00-24:00
+}
+
+define command {
+ command_name notify-by-nothing
+ command_line /bin/true
+}
+
+define command{
+ command_name notify-by-email
+ command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nState: $SERVICESTATE$ for $SERVICEDURATION$\nAddress: $HOSTADDRESS$\n\nInfo:\n\n$SERVICEOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\nACK by: $SERVICEACKAUTHOR$\nComment: $SERVICEACKCOMMENT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert $NOTIFICATIONNUMBER$ - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
+}
+
+define contact {
+ contact_name root
+ alias Root
+ host_notification_period 24x7
+ service_notification_period 24x7
+ host_notification_options d,r
+ service_notification_options w,u,c,r
+ host_notification_commands notify-by-nothing
+ service_notification_commands notify-by-nothing
+ email root@postoffice
+}
+
+define contactgroup{
+ contactgroup_name admins
+ alias Nagios Administrators
+ members root
+}
+
+define host {
+ name server-host
+ check_command check-host-alive
+ max_check_attempts 10
+ event_handler_enabled 1
+ flap_detection_enabled 1
+ process_perf_data 1
+ retain_status_information 1
+ retain_nonstatus_information 1
+ notification_interval 0
+ notification_period 24x7
+ notifications_enabled 1
+ failure_prediction_enabled 1
+ register 0
+ notification_options d,u,r
+ contact_groups admins
+}
+
+define service {
+ name server-service
+ is_volatile 0
+ max_check_attempts 4
+ normal_check_interval 5
+ retry_check_interval 1
+ active_checks_enabled 1
+ passive_checks_enabled 1
+ check_period 24x7
+ parallelize_check 1
+ obsess_over_service 1
+ check_freshness 0
+ event_handler_enabled 1
+ flap_detection_enabled 1
+ process_perf_data 1
+ retain_status_information 1
+ retain_nonstatus_information 1
+ notification_interval 0
+ notification_period 24x7
+ notifications_enabled 1
+ failure_prediction_enabled 1
+ register 0
+ notification_options w,u,c,r
+ contact_groups admins
+}
+
+define command{
+ command_name check_disk
+ command_line /usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
+}
+
+define command{
+ command_name check_http
+ command_line /usr/lib/nagios/plugins/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$
+}
+
+define command{
+ command_name check_load
+ command_line /usr/lib/nagios/plugins/check_load --warning=$ARG2$ --critical=$ARG2$
+}
+
+define command{
+ command_name check_ping
+ command_line /usr/lib/nagios/plugins/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
+}
+
+define command{
+ command_name check_ssh
+ command_line /usr/lib/nagios/plugins/check_ssh $HOSTADDRESS$
+}
+
+define command{
+ command_name check_ntp
+ command_line /usr/lib/nagios/plugins/check_ntp -H $HOSTADDRESS$
+}
+
+define command{
+ command_name check_tcp
+ command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p $ARG1$
+}
+
+define command{
+ command_name check-host-alive
+ command_line /usr/lib/nagios/plugins/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
+}
diff --git a/nagios.cfg b/nagios.cfg
new file mode 100644
index 0000000..1038c99
--- /dev/null
+++ b/nagios.cfg
@@ -0,0 +1,59 @@
+# Nagios configuration file for use with the sitesummary generated
+# host and service list.
+
+cfg_file=/etc/nagios3/sitesummary-templates.cfg
+cfg_file=/var/lib/sitesummary/nagios-generated.cfg
+log_file=/var/log/nagios3/nagios.log
+temp_file=/var/cache/nagios3/nagios.tmp
+status_file=/var/cache/nagios3/status.dat
+status_update_interval=15
+nagios_user=nagios
+nagios_group=nagios
+
+log_archive_path=/var/log/nagios3/archives
+command_check_interval=-1
+
+command_file=/var/lib/nagios3/rw/nagios.cmd
+lock_file=/var/run/nagios3/nagios3.pid
+p1_file=/usr/lib/nagios3/p1.pl
+state_retention_file=/var/lib/nagios3/retention.dat
+retention_update_interval=60
+sleep_time=0.25
+max_concurrent_checks=0
+service_reaper_frequency=10
+interval_length=60
+low_service_flap_threshold=5
+high_service_flap_threshold=20
+low_host_flap_threshold=5
+high_host_flap_threshold=20
+service_check_timeout=60
+host_check_timeout=30
+event_handler_timeout=30
+notification_timeout=30
+ocsp_timeout=5
+perfdata_timeout=5
+illegal_object_name_chars=`~!$%^&*|'"<>?,()=
+
+illegal_macro_output_chars=`~$&|'"<>
+
+admin_email=root
+
+admin_pager=pageroot
+
+object_cache_file=/var/cache/nagios3/objects.cache
+service_inter_check_delay_method=s
+
+max_service_check_spread=30
+host_inter_check_delay_method=s
+
+max_host_check_spread=30
+auto_rescheduling_interval=30
+auto_rescheduling_window=180
+host_freshness_check_interval=60
+service_freshness_check_interval=60
+event_broker_options=-1
+
+host_perfdata_file_mode=a
+service_perfdata_file_mode=a
+host_perfdata_file_processing_interval=0
+service_perfdata_file_processing_interval=0