diff options
Diffstat (limited to 'Monitoring')
34 files changed, 1195 insertions, 0 deletions
diff --git a/Monitoring/Makefile b/Monitoring/Makefile new file mode 100644 index 00000000..794f9262 --- /dev/null +++ b/Monitoring/Makefile @@ -0,0 +1,23 @@ +NAGDIR = /etc/nagios3/ +NAGLIBDIR = /usr/lib/nagios +HTDOCS = /usr/share/nagios3/htdocs + +.phony: debian +debian: + git pull origin master + [ `which python` ] || apt-get install python python-simplejson + [ `which nagios3` ] || apt-get install nagios3 + rm $(NAGDIR)/conf.d/* || true + cp -r conf/* $(NAGDIR)/conf.d/ + htpasswd -bc htpasswd.users nagiosadmin krebs + htpasswd -b htpasswd.users shack shackit + sed -i 's/\(authorized_for_all_hosts=nagiosadmin\)$$/\1,shack/' $(NAGDIR)/cgi.cfg + sed -i 's/\(check_external_commands=\)0$$/\11/' $(NAGDIR)/nagios.cfg + sed -i 's/\(authorized_for_all_services=nagiosadmin\)$$/\1,shack/' $(NAGDIR)/cgi.cfg + cp -R htdocs/* $(HTDOCS) + cp -r plugins $(NAGLIBDIR) + /etc/init.d/nagios3 reload + chown nagios:www-data /var/lib/nagios3 || true + chown nagios:www-data /var/lib/nagios3/rw || true + chmod g+x /var/lib/nagios3 || true + chmod ugo=rwx /var/lib/nagios3/rw/nagios.cmd || true diff --git a/Monitoring/TODO b/Monitoring/TODO new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Monitoring/TODO diff --git a/Monitoring/conf/extinfo.cfg b/Monitoring/conf/extinfo.cfg new file mode 100644 index 00000000..e4300b72 --- /dev/null +++ b/Monitoring/conf/extinfo.cfg @@ -0,0 +1,9 @@ +define hostextinfo{ + hostgroup_name debian-servers + notes Debian GNU/Linux servers +# notes_url http://webserver.localhost.localdomain/hostinfo.pl?host=netware1 + icon_image base/debian.png + icon_image_alt Debian GNU/Linux + vrml_image debian.png + statusmap_image base/debian.gd2 + } diff --git a/Monitoring/conf/hostgroups_generic.cfg b/Monitoring/conf/hostgroups_generic.cfg new file mode 100644 index 00000000..4e3625c5 --- /dev/null +++ b/Monitoring/conf/hostgroups_generic.cfg @@ -0,0 +1,28 @@ +# A simple wildcard hostgroup +define hostgroup { + hostgroup_name all + alias All Servers + members * + } + +# A list of your Debian GNU/Linux servers +define hostgroup { + hostgroup_name debian-servers + alias Debian GNU/Linux Servers + members localhost + } + +# A list of your web servers +define hostgroup { + hostgroup_name http-servers + alias HTTP servers + members localhost + } + +# A list of your ssh-accessible servers +define hostgroup { + hostgroup_name ssh-servers + alias SSH servers + members localhost + } + diff --git a/Monitoring/conf/krebs_hosts.cfg b/Monitoring/conf/krebs_hosts.cfg new file mode 100644 index 00000000..a929fa19 --- /dev/null +++ b/Monitoring/conf/krebs_hosts.cfg @@ -0,0 +1,78 @@ + +# +# Ur-Krebs +# +define host{ + use generic-host + host_name krebs.shack + alias krebs + _tinc_address 10.7.7.156 + address 10.42.23.5 + parents shack-coreswitch + hostgroups krebs-machines,tinc-nodes,ssh-servers + } +# +# UTART +# +define host{ + use generic-host + host_name utart + alias UTART + _tinc_address 10.7.7.66 + address 10.42.23.23 + parents shack-coreswitch + hostgroups krebs-machines,tinc-nodes,ssh-servers + } +# +# ytart +# will use tinc ip as long as no static ip is supplied +# +define host{ + use generic-host + host_name ytart + alias ytart + _tinc_address 10.7.7.201 + parents shack-wlan-ap5 + address 10.7.7.201 + hostgroups krebs-machines,tinc-nodes,ssh-servers + } +# +# uPM +# +define host{ + use generic-host + host_name upm + alias uPM Virtual Machine + _tinc_address 10.7.7.99 + address upm.shack + parents shack-node1 + hostgroups krebs-machines,ssh-servers,shack-rz + #,tinc-nodes + } + +# TODO add upm and genericore as tinc-nodes +# TODO check MONGODB on uPM + + + +#TODO verkrebse genericore/get password +define host{ + use generic-host + host_name genericore + alias genericore Virtual Machine + #_tinc_address 10.7.7.XX + address genericore.shack + parents shack-node1 + hostgroups ssh-servers,shack-rz + #,tinc-nodes,krebs-machines + } + +define host{ + use generic-host + host_name shepherd + alias Shepherd Krebs + _tinc_address 10.7.7.29 + address 10.42.23.42 + parents shack-coreswitch + hostgroups krebs-machines,tinc-nodes,ssh-servers + } diff --git a/Monitoring/conf/krebsnet.cfg b/Monitoring/conf/krebsnet.cfg new file mode 100644 index 00000000..ae5b898e --- /dev/null +++ b/Monitoring/conf/krebsnet.cfg @@ -0,0 +1,20 @@ +## extended infos for krebsnet +define hostgroup { + hostgroup_name krebs-machines + alias Krebs Machines + } +define hostextinfo{ + hostgroup_name krebs-machines + notes Deployed Krebse +# notes_url http://webserver.localhost.localdomain/hostinfo.pl?host=netware1 + icon_image krebs/krebs.png + icon_image_alt Krebs + vrml_image krebs.png + statusmap_image krebs/krebs.gd2 + } +#define host{ +# use generic-host +# register 0 +# name tinc-only-host +# check_command check_internal_tinc_up!100.0,20%!500.0,60% +# } diff --git a/Monitoring/conf/localhost.cfg b/Monitoring/conf/localhost.cfg new file mode 100644 index 00000000..3b098195 --- /dev/null +++ b/Monitoring/conf/localhost.cfg @@ -0,0 +1,60 @@ +# A simple configuration file for monitoring the local host +# This can serve as an example for configuring other servers; +# Custom services specific to this host are added here, but services +# defined in nagios2-common_services.cfg may also apply. +# + +define host{ + use generic-host ; Name of host template to use + host_name localhost + alias localhost + address 127.0.0.1 + hostgroups krebs-machines + } + +# Define a service to check the disk space of the root partition +# on the local machine. Warning if < 20% free, critical if +# < 10% free space on partition. + +define service{ + use generic-service ; Name of service template to use + host_name localhost + service_description Disk Space + check_command check_all_disks!20%!10% + } + + + +# Define a service to check the number of currently logged in +# users on the local machine. Warning if > 20 users, critical +# if > 50 users. + +define service{ + use generic-service ; Name of service template to use + host_name localhost + service_description Current Users + check_command check_users!20!50 + } + + +# Define a service to check the number of currently running procs +# on the local machine. Warning if > 250 processes, critical if +# > 400 processes. + +define service{ + use generic-service ; Name of service template to use + host_name localhost + service_description Total Processes + check_command check_procs!250!400 + } + + + +# Define a service to check the load on the local machine. + +define service{ + use generic-service ; Name of service template to use + host_name localhost + service_description Current Load + check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 + } diff --git a/Monitoring/conf/other_hosts.cfg b/Monitoring/conf/other_hosts.cfg new file mode 100644 index 00000000..bbdc676a --- /dev/null +++ b/Monitoring/conf/other_hosts.cfg @@ -0,0 +1,22 @@ +define host{ + use generic-host + host_name google.de + alias Google Website + address google.de + parents shack-gw + hostgroups http-servers + } + +define host{ + use generic-host + host_name google-dns + parents shack-gw + alias Google DNS Service (always reachable) + address 8.8.8.8 + } +define service { + host_name google-dns + service_description DNS Service + use generic-service + check_command check_dns + } diff --git a/Monitoring/conf/services.cfg b/Monitoring/conf/services.cfg new file mode 100644 index 00000000..e3a61eb0 --- /dev/null +++ b/Monitoring/conf/services.cfg @@ -0,0 +1,26 @@ +# check that web services are running +define service { + hostgroup_name http-servers + service_description HTTP + check_command check_http + use generic-service + notification_interval 0 ; set > 0 if you want to be renotified +} + +# check that ssh services are running +define service { + hostgroup_name ssh-servers + service_description SSH + check_command check_ssh + use generic-service + notification_interval 0 ; set > 0 if you want to be renotified +} + +# check that ping-only hosts are up +define service { +# hostgroup_name ping-servers + service_description PING + check_command check_ping!100.0,20%!500.0,60% + use generic-service + notification_interval 0 ; set > 0 if you want to be renotified +} diff --git a/Monitoring/conf/shack_contacts.cfg b/Monitoring/conf/shack_contacts.cfg new file mode 100644 index 00000000..832a215e --- /dev/null +++ b/Monitoring/conf/shack_contacts.cfg @@ -0,0 +1,22 @@ +define contact{ + contact_name makefu + alias makefu + service_notification_period 24x7 + host_notification_period 24x7 + service_notification_options w,u,c,r + host_notification_options d,u,r + service_notification_commands notify-service-by-email + host_notification_commands notify-host-by-email + email shack_nagios_notification@syntax-fehler.de + } +define contactgroup{ + contactgroup_name krebsminers + alias Krebsminers + members makefu + } + +define contactgroup{ + contactgroup_name admins + alias admins + } + diff --git a/Monitoring/conf/shack_guests.cfg b/Monitoring/conf/shack_guests.cfg new file mode 100644 index 00000000..5832725a --- /dev/null +++ b/Monitoring/conf/shack_guests.cfg @@ -0,0 +1,105 @@ +# +# Bitcoin mines +# +define host{ + use generic-host + host_name gauda0 + parents shack-serverswitch + alias Gauda0 Bitcoin Mining Rig 0 + address 10.42.0.99 + hostgroups bitcoin-miner + } +define host{ + use generic-host + host_name gauda1 + parents shack-serverswitch2 + alias Gauda1 Bitcoin Mining Rig 1 + address 10.42.0.98 + hostgroups bitcoin-miner + } +define host{ + use generic-host + host_name gauda2 + parents shack-serverswitch2 + alias Gauda2 Bitcoin Mining Rig 2 + address 10.42.0.97 + hostgroups bitcoin-miner + } + +#Chinaman +define host{ + use generic-host + host_name chinaman + parents shack-router + alias Chinaman Bitcoin Mining Rig + #address 10.42.0.96 + #_TINC_ADDRESS 10.7.7.6 + address 10.7.7.6 + _SPEED_URL http://leechi.kicks-ass.org/tmp/live/chinaman_bitcoinslc_live + _TEMPER_URL http://leechi.kicks-ass.org/tmp/live/chinaman_ati_temper + hostgroups bitcoin-miner,tinc-nodes,ssh-servers + contact_groups krebsminers + } +define command { + command_name check_speed + command_line $USER1$/check_speed $_HOSTSPEED_URL$ $ARG1$ + } +define service { + host_name chinaman + service_description Temperature Checker + use generic-service + check_command check_temper!85 85 65 45 + contact_groups krebsminers + } +define command { + command_name check_temper + command_line $USER1$/check_temper $_HOSTTEMPER_URL$ $ARG1$ + } +define service { + host_name chinaman + service_description Mining Speed checker + use generic-service + check_command check_speed!600 + contact_groups krebsminers + } +#define service { +# host_name chinaman +# service_description BTCGUILD hash rate checker +# use generic-service +# check_command check_btcguild_miner!4bf1543d2eca8648277bdc66c326eea9!txgen_chinaman!450 +# contact_groups krebsminers +# } + + +#define command { +# command_name check_btcguild_miner +# command_line $USER1$/check_btcguild_miner $ARG1$ $ARG2$ $ARG3$ +# } + +define host{ + use generic-host + host_name Sascha privater Server + parents shack-serverswitch + alias Sascha Server + address 10.42.23.100 + #hostgroups bitcoin-miner + } + +define host{ + use generic-host + host_name Telefonzelle + parents shack-coreswitch + alias Telefonzelle + address 10.42.23.101 + #hostgroups bitcoin-miner + } + +define host{ + use generic-host + host_name shack-pnp + alias Shack Bestueckungsautomat + address 10.42.100.5 + parents shack-coreswitch + #hostgroups shack-rz + } + diff --git a/Monitoring/conf/shack_infrastructure.cfg b/Monitoring/conf/shack_infrastructure.cfg new file mode 100644 index 00000000..f404f3e4 --- /dev/null +++ b/Monitoring/conf/shack_infrastructure.cfg @@ -0,0 +1,241 @@ +# + +# +# Shack Virtual Machine Hoster Platform +# + +# +# Virtualization and storage +# +define host{ + use generic-host + host_name shack-node0 + alias Shack Virtualization Server 0 + address 10.42.0.10 + parents shack-serverswitch + hostgroups shack-rz,ssh-servers + } +define host{ + use generic-host + host_name shack-node1 + alias Shack Virtualization Server 1 + address 10.42.0.10 + parents shack-serverswitch + hostgroups shack-rz,ssh-servers + } +define host{ + use generic-host + host_name shack-plattenschwein + parents shack-serverswitch + alias Shack Plattenschwein + address 10.42.0.12 + hostgroups shack-rz,ssh-servers + } +# +# Network Infrastructure +# + +# +## Shack gateway (no gateway-no internet) +# +define host{ + use generic-host + host_name shack-gw + parents shack-coreswitch + alias Watchguard Shack Gateway + address 10.42.0.1 + hostgroups shack-rz,ssh-servers + } +#deprecated +#define host{ +# use generic-host +# host_name shack-modem +# parents shack-gw +# alias Shack Telecom VDSL Router +# address 192.168.2.1 +# hostgroups shack-rz +# } +define host{ + use generic-host + host_name shack-externswitch + parents shack-gw + alias Shack External Switch (2.OG) + address 10.0.10.2 + hostgroups shack-rz + } +# +# Serverswitch 2 +# +define host{ + use generic-host + host_name shack-serverswitch2 + parents shack-serverswitch + alias Shack switch Rack 2 (cisco 3524) + address 10.42.0.5 + hostgroups shack-rz + } + +define service { + host_name shack-serverswitch2 + service_description Telnet + use generic-service + check_command check_telnet + } + +define service { + host_name shack-serverswitch2 + service_description Admin HTTP Terminal + use generic-service + check_command check_http + } + + +define service { + host_name shack-gw + service_description DNS Service + use generic-service + check_command check_dns + } +define host{ + use generic-host + host_name shack-coreswitch + alias Shack Cisco Router Coreswitch + address 10.42.0.3 + hostgroups shack-rz,ssh-servers + } +define host{ + use generic-host + host_name shack-serverswitch + parents shack-coreswitch + alias Shack Cisco Router Serverswitch + address 10.42.0.4 + hostgroups shack-rz + } + +define host{ + use generic-host + host_name shack-wlan-ap2 + parents shack-coreswitch + alias Shack Wlan Access Point 2 + address 10.42.0.6 + hostgroups wlan-ap + } +define host{ + use generic-host + host_name shack-wlan-ap3 + parents shack-coreswitch + alias Shack Wlan Access Point 3 + address 10.42.0.7 + hostgroups wlan-ap + } +define host{ + use generic-host + host_name shack-wlan-ap4 + parents shack-coreswitch + alias Shack Wlan Access Point 4 + address 10.42.0.8 + hostgroups wlan-ap + } +define host{ + use generic-host + host_name shack-wlan-ap5 + parents shack-coreswitch + alias Shack Wlan Access Point 5 + address 10.42.0.9 + hostgroups wlan-ap + } +# +# Voip Infrastructure +# +define host{ + use generic-host + host_name shack-voip + alias Shack Cisco VOIP Gateway + address 10.42.0.2 + parents shack-coreswitch + hostgroups shack-rz,http-servers + } + +define service{ + host_name shack-voip + service_description SIP Service + use generic-service + check_command check_sip + } + +# +# Shack DNS Server +# + +define host{ + use generic-host + host_name shack-dns + parents shack-node0 + alias Shack DNS Virtual Host + address 10.42.0.100 + hostgroups shack-rz + } +define service { + host_name shack-dns + service_description DNS Service + use generic-service + check_command check_dns_shack + } + +define host{ + use generic-host + host_name shack-pxe + parents shack-node0 + alias Shack PXEBoot Vhost + address pxeboot.shack + hostgroups shack-rz + } + +define host{ + use generic-host + host_name shack-printsrv + parents shack-node1 + alias Shack Print Server + address printer.shack + hostgroups shack-rz + } + +define host{ + use generic-host + host_name shack-aptproxy + parents shack-node0 + alias Shack Apt-proxy + address aptproxy.shack + hostgroups shack-rz + } + +define host{ + use generic-host + host_name shack-shack + parents shack-node1 + alias Shack Data Exchange + address shack.shack + hostgroups shack-rz,ssh-servers + } + +# +# shack ldap server +# +define host{ + use generic-host + host_name shack-ldap + parents shack-node0 + alias Shack LDAP Server + address ldap.shack + hostgroups shack-rz + } +define service { + host_name shack-ldap + service_description LDAP Service + use generic-service + check_command check_ldap!shammunity + } + +# +# Random stuff (not necessary located in RZ) +# diff --git a/Monitoring/conf/shacknet.cfg b/Monitoring/conf/shacknet.cfg new file mode 100644 index 00000000..802e5e3a --- /dev/null +++ b/Monitoring/conf/shacknet.cfg @@ -0,0 +1,47 @@ +define hostgroup { + hostgroup_name shack-rz + alias Shack RZ Infrastructure + } +define hostgroup { + hostgroup_name bitcoin-miner + alias Bitcoin miner in Shack-RZ + } +define hostextinfo{ + hostgroup_name bitcoin-miner + notes Bitcoin miner in Shack-RZ + icon_image krebs/bitcoin_miner.png + icon_image_alt bitcoin_miner + vrml_image bitcoin_miner.png + statusmap_image krebs/bitcoin_miner.gd2 + } + +define hostgroup { + hostgroup_name wlan-ap + alias Shack Wlan Access Points + } +define hostextinfo{ + hostgroup_name wlan-ap + notes Access Points for Shack + icon_image krebs/wireless_access_point.png + icon_image_alt wireless_access_point + vrml_image wireless_access_point.png + statusmap_image krebs/wireless_access_point.gd2 + } +define hostextinfo{ + hostgroup_name shack-rz + notes Shack RZ Infrastructure + icon_image krebs/shack.png + icon_image_alt shack-RZ + vrml_image shack.png + statusmap_image krebs/shack.gd2 + } + +define command { + command_name check_sip + command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 5060 + } + +define command { + command_name check_dns_shack + command_line $USER1$/check_dns -H shack.shack -s '$HOSTADDRESS$' + } diff --git a/Monitoring/conf/templates.cfg b/Monitoring/conf/templates.cfg new file mode 100644 index 00000000..41807e1c --- /dev/null +++ b/Monitoring/conf/templates.cfg @@ -0,0 +1,45 @@ +# generic service template definition +define service{ + name generic-service ; The 'name' of this service template + active_checks_enabled 1 ; Active service checks are enabled + passive_checks_enabled 1 ; Passive service checks are enabled/accepted + parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems) + obsess_over_service 1 ; We should obsess over this service (if necessary) + check_freshness 0 ; Default is to NOT check service 'freshness' + notifications_enabled 1 ; Service notifications are enabled + event_handler_enabled 1 ; Service event handler is enabled + flap_detection_enabled 1 ; Flap detection is enabled + failure_prediction_enabled 1 ; Failure prediction is enabled + process_perf_data 1 ; Process performance data + retain_status_information 1 ; Retain status information across program restarts + retain_nonstatus_information 1 ; Retain non-status information across program restarts + notification_interval 0 ; Only send notifications on status change by default. + is_volatile 0 + check_period 24x7 + normal_check_interval 5 + retry_check_interval 1 + max_check_attempts 4 + notification_period 24x7 + notification_options w,u,c,r + contact_groups admins + register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE! + } +# Generic host definition template - This is NOT a real host, just a template! + +define host{ + name generic-host ; The name of this host template + notifications_enabled 1 ; Host notifications are enabled + event_handler_enabled 1 ; Host event handler is enabled + flap_detection_enabled 1 ; Flap detection is enabled + failure_prediction_enabled 1 ; Failure prediction is enabled + process_perf_data 1 ; Process performance data + retain_status_information 1 ; Retain status information across program restarts + retain_nonstatus_information 1 ; Retain non-status information across program restarts + check_command check-host-alive + max_check_attempts 10 + notification_interval 0 + notification_period 24x7 + notification_options d,u,r + contact_groups admins + register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! + } diff --git a/Monitoring/conf/timeperiods.cfg b/Monitoring/conf/timeperiods.cfg new file mode 100644 index 00000000..55ecf9df --- /dev/null +++ b/Monitoring/conf/timeperiods.cfg @@ -0,0 +1,50 @@ +############################################################################### +# timeperiods.cfg +############################################################################### + +# This defines a timeperiod where all times are valid for checks, +# notifications, etc. The classic "24x7" support nightmare. :-) + +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 + } + +# Here is a slightly friendlier period during work hours +define timeperiod{ + timeperiod_name workhours + alias Standard Work Hours + monday 09:00-17:00 + tuesday 09:00-17:00 + wednesday 09:00-17:00 + thursday 09:00-17:00 + friday 09:00-17:00 + } + +# The complement of workhours +define timeperiod{ + timeperiod_name nonworkhours + alias Non-Work Hours + sunday 00:00-24:00 + monday 00:00-09:00,17:00-24:00 + tuesday 00:00-09:00,17:00-24:00 + wednesday 00:00-09:00,17:00-24:00 + thursday 00:00-09:00,17:00-24:00 + friday 00:00-09:00,17:00-24:00 + saturday 00:00-24:00 + } + +# This one is a favorite: never :) +define timeperiod{ + timeperiod_name never + alias Never + } + +# end of file diff --git a/Monitoring/conf/tinc_hosts.cfg b/Monitoring/conf/tinc_hosts.cfg new file mode 100644 index 00000000..717c75a8 --- /dev/null +++ b/Monitoring/conf/tinc_hosts.cfg @@ -0,0 +1,33 @@ +#connection will not work if no internet is available (e.g. no shack-gateway) + +# +# Miefda Supernode +# +define host{ + use generic-host + host_name supernode + alias Supernode External + _TINC_ADDRESS 10.7.7.1 + address miefda.org + parents shack-gw + hostgroups tinc-nodes,ssh-servers,http-servers + } + +define service { + host_name supernode + service_description IRC + use generic-service + check_command check_ircd + } +# +# Sharepoint (dhbw-stuttgart) +# +define host{ + use generic-host + host_name sharepoint + alias PA Sharepoint + address 141.31.8.11 + _TINC_ADDRESS 10.7.7.5 + parents shack-gw + hostgroups tinc-nodes,ssh-servers + } diff --git a/Monitoring/conf/tincnet.cfg b/Monitoring/conf/tincnet.cfg new file mode 100644 index 00000000..f0b35b4e --- /dev/null +++ b/Monitoring/conf/tincnet.cfg @@ -0,0 +1,31 @@ +define hostgroup { + hostgroup_name tinc-nodes + alias Tinc Nodes + } + +define hostextinfo{ + hostgroup_name tinc-nodes + notes Tinc Nodes + icon_image krebs/tinc.png + icon_image_alt tinc + vrml_image tinc.png + statusmap_image krebs/tinc.gd2 + } + +define command { + command_name check_internal_tinc_up + command_line $USER1$/check_ping -H $_HOSTTINC_ADDRESS$ -w $ARG1$ -c $ARG2$ + } +define command { + command_name check_ircd + command_line $USER1$/check_ircd $_HOSTTINC_ADDRESS$ + } + +define service { + hostgroup_name tinc-nodes + service_description tinc internal + check_command check_internal_tinc_up!100.0,20%!500.0,60% + use generic-service + notification_interval 0 +} + diff --git a/Monitoring/htdocs/images/logos/krebs/bitcoin_miner.gd2 b/Monitoring/htdocs/images/logos/krebs/bitcoin_miner.gd2 Binary files differnew file mode 100644 index 00000000..5e585c62 --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/bitcoin_miner.gd2 diff --git a/Monitoring/htdocs/images/logos/krebs/bitcoin_miner.png b/Monitoring/htdocs/images/logos/krebs/bitcoin_miner.png Binary files differnew file mode 100644 index 00000000..87200fe4 --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/bitcoin_miner.png diff --git a/Monitoring/htdocs/images/logos/krebs/favicon.ico b/Monitoring/htdocs/images/logos/krebs/favicon.ico Binary files differnew file mode 100644 index 00000000..fa18384c --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/favicon.ico diff --git a/Monitoring/htdocs/images/logos/krebs/krebs.gd2 b/Monitoring/htdocs/images/logos/krebs/krebs.gd2 Binary files differnew file mode 100644 index 00000000..1113f03e --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/krebs.gd2 diff --git a/Monitoring/htdocs/images/logos/krebs/krebs.png b/Monitoring/htdocs/images/logos/krebs/krebs.png Binary files differnew file mode 100644 index 00000000..3d8a8ab8 --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/krebs.png diff --git a/Monitoring/htdocs/images/logos/krebs/shack.gd2 b/Monitoring/htdocs/images/logos/krebs/shack.gd2 Binary files differnew file mode 100644 index 00000000..8b0d98e5 --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/shack.gd2 diff --git a/Monitoring/htdocs/images/logos/krebs/shack.png b/Monitoring/htdocs/images/logos/krebs/shack.png Binary files differnew file mode 100644 index 00000000..53f1275b --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/shack.png diff --git a/Monitoring/htdocs/images/logos/krebs/tinc.gd2 b/Monitoring/htdocs/images/logos/krebs/tinc.gd2 Binary files differnew file mode 100644 index 00000000..36572d4a --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/tinc.gd2 diff --git a/Monitoring/htdocs/images/logos/krebs/tinc.png b/Monitoring/htdocs/images/logos/krebs/tinc.png Binary files differnew file mode 100644 index 00000000..daa1fdeb --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/tinc.png diff --git a/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 b/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 Binary files differnew file mode 100644 index 00000000..6e740ec4 --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 diff --git a/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png b/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png Binary files differnew file mode 100644 index 00000000..9febe45e --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png diff --git a/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png b/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png Binary files differnew file mode 100644 index 00000000..fe9788af --- /dev/null +++ b/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png diff --git a/Monitoring/htpasswd.users b/Monitoring/htpasswd.users new file mode 100644 index 00000000..7d4bbd6c --- /dev/null +++ b/Monitoring/htpasswd.users @@ -0,0 +1,2 @@ +nagiosadmin:wriRAagrgh5mk +shack:i8ZRZOQKu3mgw diff --git a/Monitoring/plugins/check_btcguild_miner b/Monitoring/plugins/check_btcguild_miner new file mode 100755 index 00000000..2e6a8de3 --- /dev/null +++ b/Monitoring/plugins/check_btcguild_miner @@ -0,0 +1,36 @@ +#!/usr/bin/python + +import sys +from urllib2 import urlopen +try: + import json + getattr(json,"load") +except: #deal with it + import simplejson as json + +if len(sys.argv) != 4 : + print "** Usage: %s APIKEY WORKER_NAME LOW_WORKER_SPEED" % sys.argv[0] + print "** aka YOU ARE MADE OF STUPID" + exit (3) + +API_KEY=sys.argv[1] +WORKER_NAME=sys.argv[2] +LOW_WORKER_SPEED=float(sys.argv[3]) +url="http://www.btcguild.com/api.php?api_key=%s" % API_KEY +try: + fh = urlopen(url) + result = json.load(fh) +except Exception,e: + print "?? cannot parse json or connect to server: %s"% str(e) + exit (1) + +for k,v in result["workers"].iteritems(): + if v["worker_name"] == WORKER_NAME: + curr = v["hash_rate"] + if curr < LOW_WORKER_SPEED: + print "!! %f is below expected %f" % (curr,LOW_WORKER_SPEED) + exit (2) + else: + print "++ everything fine, current speed is %f" % curr + exit(0) + diff --git a/Monitoring/plugins/check_sip b/Monitoring/plugins/check_sip new file mode 100755 index 00000000..24374727 --- /dev/null +++ b/Monitoring/plugins/check_sip @@ -0,0 +1,252 @@ +#!/usr/bin/perl -w +# +# check_sip plugin for nagios +# $Revision: 1.2 $ +# +# Nagios plugin to check SIP servers +# +# By Sam Bashton, Bashton Ltd +# bashton.com/content/nagiosplugins +# Michael Hirschbichler, Institute of Broadband Communications, +# Vienna University of Technology +# +# This program is free software; you can 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 of the License, or +# (at your option) any later version. +# +# This program 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 +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +use strict; +use lib "/usr/lib/nagios/plugins"; +use utils qw($TIMEOUT %ERRORS &print_revision &support); +use vars qw($PROGNAME); +use IO::Socket::INET; +#use Sys::Hostname; +use Time::HiRes qw(gettimeofday); +use Net::Domain qw (hostname hostfqdn hostdomain); + +$PROGNAME = "check_sip"; +my $VERSION = "1.2"; + +$ENV{'BASH_ENV'}=''; +$ENV{'ENV'}=''; +$ENV{'PATH'}=''; +$ENV{'LC_ALL'}='C'; + +my ($opt_V,$opt_h,$opt_u,$opt_p,$opt_H, $opt_w, $opt_s, $opt_f); +$opt_V = $opt_h = $opt_u = $opt_p = $opt_H = $opt_w = $opt_s = $opt_f = ''; + +my $state = 'UNKNOWN'; + +use Getopt::Long; +Getopt::Long::Configure('bundling'); +GetOptions( + "V" => \$opt_V, "version" => \$opt_V, + "h" => \$opt_h, "help" => \$opt_h, + "s" => \$opt_s, + "f=s" => \$opt_f, "fromuri=s" => \$opt_f, + "u=s" => \$opt_u, "uri=s" => \$opt_u, + "p=s" => \$opt_p, "port=s" => \$opt_p, + "H=s" => \$opt_H, "host=s" => \$opt_H, + "w=s" => \$opt_w, "warn=s" => \$opt_w +); + +# -h displays help +if ($opt_h) { printHelp(); exit $ERRORS{'OK'}; } + +# -V display version number +if ($opt_V) { + print_revision($PROGNAME, $VERSION); + exit $ERRORS{'OK'}; +}; + +# Check the sip URI is OK +unless ($opt_u) { printHelp(); exit $ERRORS{'UNKNOWN'} } + +# Port is 5060 unless otherwise specified +unless ($opt_p) { $opt_p = 5060 } + +# Determine the host from the sip URI if it wasn't specified with -H +unless ($opt_H) { $opt_H = hostFromURI($opt_u) } + +# Check the host is valid +unless (utils::is_hostname($opt_H)) +{ + print "$opt_H is not a valid hostname\n"; + printHelp(); + exit $ERRORS{"UNKNOWN"}; +} + +unless ($opt_w) { $opt_w = 5 } # Warn if response takes longer than 5 seconds + +### Main code ############################################################### + +# Timeout if we don't recieve a response within a suitable timeframe.. +$SIG{'ALRM'} = sub { + print ("SIP timeout: No response from SIP server after $TIMEOUT seconds\n"); + exit $ERRORS{"CRITICAL"}; +}; +alarm($TIMEOUT); + +my $localhost = hostfqdn(); +$opt_f = getFromURI($opt_f,$localhost,$opt_p); +my $user=getUserPart($opt_f); +my $socket = uconnect($opt_H, $opt_p); +my @localinfo = unpack_sockaddr_in($socket->sockname); +my $req = buildReq($localinfo[0], $opt_u, $opt_f,$user,$localhost); +my (undef, $starttime) = gettimeofday; +$socket->send($req); +my $response; +$socket->recv($response, 1024) or $state = 'CRITICAL'; + +#get rid of the 100 Trying - provisional response ... +if (getResponseCode($response) eq "100"){ + $socket->recv($response, 1024) or $state = 'CRITICAL'; +} + +my (undef, $finishtime) = gettimeofday; +my $rtime = ($finishtime - $starttime) / 1000000; # Time taken in seconds +if(checkResponse($response,$rtime,$opt_s)) +{ + if ($rtime > $opt_w) { $state = 'WARNING' } + else { $state = 'OK' } +} +else { $state = 'CRITICAL' } + +exit $ERRORS{$state}; + +### Subroutines ############################################################## + + +sub uconnect +{ + my ($host, $port) = @_; + my $socket = new IO::Socket::INET->new(PeerPort=>$port, Proto=>'udp', PeerAddr=>$host); + unless ($socket) { print "Unable to connect to $host\n"; exit $ERRORS{'UNKNOWN'} } + return $socket; +} + +sub getFromURI{ + my ($from, $localhost,$localport) = @_; + if (!("$from" eq "")){ + return "$from:$localport"; + }else + { + return "sip:checksip\@$localhost:$localport"; + } +} + +sub getUserPart{ + my ($uri) = @_; + my @uris=split(/\@/,$uri); + my $user=$uris[0]; + return $user; +} + +sub hostFromURI +{ + my ($uri) = @_; + $uri =~ s/sip:[^\@]+@//; + return $uri; +} + +sub getResponseCode +{ + my ($message) = @_; + my @messageparts=split(/\ /,$message); + return $messageparts[1]; +} + +sub buildReq +{ + my ($localport, $dsturi, $fromuri,$user,$localhost) = @_; + + my $req; + my $tag = genTag(); + my $idtag = genTag(); + $req.= "OPTIONS $dsturi SIP/2.0\r\n"; + $req.= "Via: SIP/2.0/UDP $localhost:$localport;branch=z9hG4bKhjhs8ass877\r\n"; + $req.= "Max-Forwards: 70\r\n"; + $req.= "To: $dsturi\r\n"; + $req.= "From: $fromuri;tag=$tag\r\n"; + $req.= "Call-ID: $idtag\@$localhost\r\n"; + $req.= "CSeq: 1 OPTIONS\r\n"; + $req.= "Contact: <$user\@$localhost:$localport>\r\n"; + $req.= "Accept: application/sdp\r\n"; + $req.= "Content-Length: 0\r\n\r\n"; + return $req; +} + +sub genTag +{ + my $tag; + my @chars = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p', + 'q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8', + '9'); + + for (my $i = 0; $i < 6; $i++) + { + $tag .= $chars[rand(scalar @chars)]; + } + return $tag; +} + +sub printHelp +{ + print "This plugin tests the sip service on the specified host.\n\n"; + print "Usage: $PROGNAME -u sip:uri\@example.com [-H host -p PORT -f sip:fromuri\@example.com -w WARNTIME -s]\n"; + print " $PROGNAME [-h | --help]\n"; + print " $PROGNAME [-V | --version]\n\n"; + print "Options:\n"; + print " -u sip:uri\@example.com\n"; + print " Full SIP uri, eg sip:uri\@example.com\n"; + print " -h, --help\n"; + print " Print this help\n"; + print " -V, --version\n"; + print " Print version information\n"; + print " -H host\n"; + print " Host name or IP Address to connect to\n"; + print " -p port\n"; + print " Port to connect to\n"; + print " -f sip:fromuri\@example.com\n"; + print " Full SIP uri, will be used for the \"From:\"-Header\n"; + print " -s\n"; + print " Changes default behavior: all SIP-responses will result in an \"OK\"\n\n"; + + +} + +sub checkResponse +{ + my ($response, $rtime, $sp_behavior) = @_; + my @header=split(/\r/,$response); + my $tstring=$header[0]; + my $rcode=getResponseCode($response); + if (!$sp_behavior){ + #in this case, we want to see if the SIP-server is respoding positively to our request + # Some SUT respond with 100 Trying - assume everything is OK if we get this + if ($response =~ /^SIP.+[12]00/){ + print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; + return 1; + } + elsif ($response =~ /^SIP.+404 Not Found/) { + print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; + return 0 } + else { print "Unknown error: $tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; return 0; } + }else{ + #in this case, we accept every response from the server, as long it is SIP + if ($response =~ /^SIP./){ + print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; + return 1; + } + else { print "Unknown error: $tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; return 0; } + } +} diff --git a/Monitoring/plugins/check_speed b/Monitoring/plugins/check_speed new file mode 100755 index 00000000..14a5b612 --- /dev/null +++ b/Monitoring/plugins/check_speed @@ -0,0 +1,34 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +#TODO check_speed is nearly the same as check_speeder, consolidate both scripts, probably by giving HIGH:LOW as params +import sys +import urllib + +if len(sys.argv) < 2 or '-h' in sys.argv: + print ("?? usage: %s URL [low-mhashes] ..." % sys.argv[0]) + print ("?? Server reply should look like this: '2011-07-11T09:00 400.0'") + exit(3) + +URL=sys.argv[1] +thresholds=[ float(i) for i in sys.argv[2:]] + +ecode=0 +try: + ret = urllib.urlopen(URL).read().split() + date = ret[0] + speeds = [float(i) for i in ret[1:]] + print ("** %s : %s Mhashes" % (date,' '.join([str(i) for i in speeds]))) + if len(speeds) != len(thresholds): + raise Exception("!! Number of speeds != number of given thresholds") + for i,speed in enumerate(speeds): + if speed < thresholds[i]: + print ("!! %.2f Mhash < %.2f Mhash ! (field %d)" %(speed,thresholds[i],i)) + ecode=2 +except Exception,e: + print("!! Something aweful happened: "+str(e)) + exit (1) +#TODO return WARNING if date is too old +if not ecode: + print ("** Everything is fine!") + +exit(ecode) diff --git a/Monitoring/plugins/check_temper b/Monitoring/plugins/check_temper new file mode 100755 index 00000000..95191026 --- /dev/null +++ b/Monitoring/plugins/check_temper @@ -0,0 +1,31 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import sys +import urllib + +if len(sys.argv) < 2 or '-h' in sys.argv: + print ("?? usage: %s URL [high-val field 1] [high field 2] ..." % sys.argv[0]) + print ("?? Server reply should look like this: '2011-07-11T09:00 50.0 40.0'") + exit(3) + +URL=sys.argv[1] +thresholds=[ float(i) for i in sys.argv[2:]] + +ecode=0 +try: + ret = urllib.urlopen(URL).read().split() + date = ret[0] + temps = [float(i) for i in ret[1:]] + print ("** %s : %s" % (date,' '.join([str(i)+"°C" for i in temps]))) + if len(temps) != len(thresholds): + raise Exception("Number of temps != number of given thresholds") + for i,temp in enumerate(temps): + if temp > thresholds[i]: + print ("!! %.2f°°C > %.2f°C (field %d)!" %(temp,thresholds[i],i)) + ecode=2 +except Exception,e: + print("!! Something awful happened: "+str(e)) + exit (1) +if not ecode: + print ("** Everything is fine!") +exit(ecode) |