Tag Archives: monitor

Nagios: Monitor SSL Certs

Nagios has the ability to monitor SSL certificates for expiration. Here’s how to do it: Steps for Nagios to Monitor SSL Certs Download the check_ssl_certificate plugin from the nagios exchange site Update:A better / updated version of the plugin is available for download here ( it is mentioned on previously mentioned nagios plugins page ) Installation: Edit the script, replacing the line: use lib “/usr/lib64/nagios/plugins”; with the path to your nagios plugins directory (where utils.pm is located). For me on Ubuntu 10.04 this was use lib “/usr/lib/nagios/plugins”; Also edit the line: my $openssl = “/usr/bin/openssl”; with the path to your openssl binary. Then copy the script into your nagios plugins directory, for Ubuntu 10.04 it was /usr/lib/nagios/plugins I also updated line 155 – 158 of the script, because it has a bug that allows expired certificates to show up as passing: if ($daysLeft < 0) { print “$PROGNAME: CRITICAL – $cn expired ” . abs($daysLeft) . ” day(s) ago.\n”; exit $ERRORS{‘CRITICAL’}; } elsif ($daysLeft <= $critical) { The key part is adding in this line: exit $ERRORS{‘CRITICAL’}; To monitor a site, you will need to set up a configuration, using something like this (edit to suit your needs): define command { command_name check_ssl_certificate command_line /usr/lib/nagios/plugins/check_ssl_certificate -H $HOSTNAME$ } define service{ use generic-service host_name www.yoursite.com service_description check ssl check_command check_ssl_certificate contact_groups admins }

Posted in Server Admin, Server Administration | Tagged , , , | Leave a comment

nagios check_dns / check_ip example

Need to monitor an IP address / DNS entry with Nagios? Nagios has a plugin called check_dns just for that. The check commands are defined in this file: /etc/nagios-plugins/config/dns.cfg # ‘check_dns’ command definition define command{ command_name check_dns command_line /usr/lib/nagios/plugins/check_dns -H www.google.com -s ‘$HOSTADDRESS$’ } # ‘check_dig’ command definition define command{ command_name check_dig command_line /usr/lib/nagios/plugins/check_dig -H ‘$HOSTADDRESS$’ -l ‘$ARG1$’ } here is an alternate version I wrote to check the IP of a host, I could have used check_ip because I don’t think that command is taken, but instead I used my_check_dns: #my_check_dns command, checks to make sure a hostname resolved to a specified IP address: define command { command_name my_check_dns command_line /usr/lib/nagios/plugins/check_dns -H $ARG1$ -a $ARG2$ } this is how it would be implemented in a service: define service{ use generic-service ; Name of service template to use host_name mysite.com service_description check dns check_command my_check_dns!www.mysite.com!123.456.78.90 } Man Page: check_dns v1.4.14 (nagios-plugins 1.4.14) Copyright (c) 1999 Ethan Galstad <nagios @nagios.org> Copyright (c) 2000-2008 Nagios Plugin Development Team <nagiosplug [email protected]> This plugin uses the nslookup program to obtain the IP address for the given host/domain query. An optional DNS server to use may be specified. If no DNS server is specified, the default server(s) specified in /etc/resolv.conf will be used. Usage:check_dns -H host [-s server] [-a expected-address] [-A] [-t timeout] [-w warn] [-c crit] Options: -h, –help Print detailed help screen -V, –version Print version information -H, –hostname=HOST The name or address you want to query -s, –server=HOST Optional DNS server you … Continue reading

Posted in Security, Server Admin | Tagged , , , , | Leave a comment

How to Monitor Canon Printers with SNMP

I’m working to set up monitoring of Canon printers with SNMP, and I’m having a hard time finding resources around the internet on how to go about doing this, so this article will be collecting the resources I’ve found and putting them in once place. Commands for Monitoring Canon Printers with SNMP One of the problems that I had to look into was monitoring of CANON printers, and properly modifying Nagios config files for that: Once you understand a little how NAGIOS works you will understand what I am trying to show you here in example: in /usr/local/nagios/etc/objects/commands.cfg I added a command: define command{ command_name check_snmp_canon command_line $USER1$/check_snmp -H $HOSTADDRESS$ -l STATUS -C public $ARG1$ $ARG2$ } then in: /usr/local/nagios/etc/objects/printer.cfg you define host and service like this: define host{ use generic-printer host_name SOMECANONPRINTER alias SOMECANONPRINTER Alias address “IP of the printer goes here” hostgroups network-printers } define service{ use generic-service host_name SOMECANONPRINTER service_description Printer Status check_command check_snmp_canon!-o hrDeviceStatus.1 -r “2|3” normal_check_interval 10 retry_check_interval 1 } via http://mariuszgal.com/blog/?p=93 Some of the commands I’ve tried to execute directly from the command line use something like this: /usr/lib/nagios/plugins/check_snmp -H 192.168.0.105 -C public -o hrDeviceStatus.1 snmpwalk -v <snmp version, typically ‘2c’> -c <community string> <agent address, e.g. ‘192.168.3.141’> 1.3.6.1 snmpwalk -v 2c -c public 192.168.0.104 What is SNMP Simple Network Management Protocol (SNMP) is a set of standards for managing network devices, network devices are monitored by a SNMP manager which connects to an SNMP agent on network devices. Data which the SNMP agent … Continue reading

Posted in Linux, Server Administration, Tech Tips | Tagged , , , , , , , , , | 8 Comments