omd, we started using it

September 9th, 2011 § Leave a Comment

Over the last couple of weeks I’ve had the chance to start playing around with omd. This is an opensource project combining nagios, check_mk, php4nagios and some other stuff that might be interesting (not tested those last ones).

I started using it after playing with check_mk (an earlier version). Had to install it by hand and found out that omd currently has packages for Linux distro’s like Suse, Debian and some others. Since a Debian packege was available I decided to give it a try. The installation was a breeze. Just needed to download the .deb file and it delivered all I needed. Since I am only using it for our own company I am not worried about certain versions the software needs. It is running on a separate monitoring lan so nobody besides the people that need to monitor is able to use it.

The product itself is able to configure several sites that will be able to monitor segments as seperate users. It will start seperate apache instances giving you the potential of giving certain customers an instance where they can only see their own machines. All of the sites can be configured to create al livestatus link where one instance can combine 1 to N sites that will be monitored by one single livestatus instance. Not sure if this is a secure setup but we plan to investigate this in the near future.

The interface. Omd is giving you a general command line interface that will install instances that are very simple to handle. It is able to start, stop, restart, copy, remove, backup, etc.. instances with single line commands. One downside, if you want to copy an instance you need to stop the instance you want to copy.

The command line interface has two users. The omd user runs as root, the instance user runs as <instance name>. General commands are run as root (or as omd if you know what you are doing). Site specific commands are run as the user <site instancename>

The frontend contains some webinterfaces that will allow you to run basic operations like adding hosts, deleting hosts, decide what a host is (linux, windows, network version, snmp version) within check_mk (one of the products in an instance). It can scan the services and let you add seperate services within the scan to tag and monitor. It can also restart the instance if you need to activate changes (that is a bit silly, not needed imho if nagios would allow a dynamic config).

Performance. Omd is able to setup instances using the temp filesystem and loading this into memory as far as the hardware allows this. Where I needed a vm with 3 cpu’s and 4 gigs of mem I am now able to run 30 to 40 percent more service checks on a machine with 2 cpu’s and 2 Gb memory. I suspect I can tune this even more but I have some legacy checks that might be consuming memory and cpu. The load for 3000 plus services is very low (0.10 average).

Checks are mostly based on snmp and bulkwalk. If you do know the python and nagios syntax it will allow you to use legacy checks, new snmp checks, etc.. I am using the legacy checks to monitor IIS and MS SQL performance counters. I also monitor AD but that is mostly done by checking ports. For most of the Unix/Linux machines the normal checks are sufficient. You will have base filesystem, cpu and memory checks but describing services in the config will also allow you to monitor minimum/maximum instances of unix processes, forked or not.

For those interested in trying it:

http://omdistro.org/

Check_mk, een aanvulling op Nagios

February 16th, 2011 § 2 Comments

Sinds kort ben ik, op aanraden van een collega in een andere vestiging, eens gaan testen met Check_mk. Dit is een aanvulling op Nagios die niet alleen de status van meerdere Nagios machine’s kan combineren in 1 interface maar ook nog eens veel checks in 1 keer kan uitvoeren en opzoeken.

In het kort komt het op het volgende neer:

  • Na de installatie is er 1 basis configuratie bestand waarin je hostnames, snmp community lijsten en tags zet.
  • Er is een client die je kunt gebruiken om op een bepaalde poort te luisteren. Deze agents zijn er voor Linux, MS Windows en nog een paar os’n.

In theorie heb je aan het bovenstaande voldoende. Als je overal snmp toegang hebt dan is alleen de installatie op de bewuste Nagios machine voldoende.

Na de installatie kun je met wat simpele regels een inventaris starten. Zowel via de agent als via snmp krijg je allerlei informatie terug over het bewuste systeem. Dit zet het om in een configuratie voor Nagios en je checks zoals Filesystems, cpu, memory usage en nog wat zaken draaien.

Te zien aan het aantal opties is het nog steeds niet het product dat de makers voor ogen hebben maar al heel snel valt het grote voordeel op. Je hoeft niet meer iedere check voor iedere host apart te defineren. Als een switch ineens een actieve poort krijgt krijg je een melding dat je handmatig even je inventaris moet updaten en na een herstart die ook Nagios aanpast staat de nieuwe check er in.

Wat ik nog mis zijn zaken waar ik in het verleden lang voor heb moeten stoeien. Checks voor MS SQL, Exchange, AD en Terminal server staan er niet standaard in. Je kunt ze echter wel vrij simpel opnemen. Nadeel is dat het een aparte check zal worden terwijl alles wat check_mk zelf kan vinden in 1 connectie binnenkomt.

 

 

snmpinfo.pl een nieuwe nagios plugin

October 12th, 2010 § Leave a Comment

Poos geleden ben ik eens begonnen om zelf een nagios plugin te schrijven. Had het er al eerder over maar heb nu een initiele versie. Let op, gebruik dit niet zomaar op een productie machine. Voorlopig loopt het alleen door alle netwerkkaarten/switchpoorten en geeft een x-aantal waardes weer.

Binnenkort maak ik wel een nette versie die ergens te downloaden is, voor nu maar even een past in een blog.

Patches en opmerkingen welkom.

!/usr/bin/perl

########################### snmpinfo.pl #################
# Version : 0.1
# Date : Oct 12 2010
# Author : Hans Wolters ( h-wolters at nl.linux.org )
# License : GPL http://www.gnu.org/licenses/gpl.txt
# Changelog : Inititial version, will only gather info
#             about all of the devices.
#             Tested on single machines, vmware, cisco
# Usage
# snmpinfo.pl -h hostname -C community -p portnumber
#########################################################

use strict;
#use warnings;

use Net::SNMP;
use Getopt::Long;

my $OID_ifTotal         = ‘.1.3.6.1.2.1.2.1.0′;
my $OID_ifDescr         = ‘.1.3.6.1.2.1.2.2.1.2′;
my $OID_ifType          = ‘.1.3.6.1.2.1.2.2.1.3′;
my $OID_ifMtu           = ‘.1.3.6.1.2.1.2.2.1.4′;
my $OID_ifSpeed         = ‘.1.3.6.1.2.1.2.2.1.5′;
my $OID_ifAdminStatus   = ‘.1.3.6.1.2.1.2.2.1.7′;
my $OID_ifOperStatus    = ‘.1.3.6.1.2.1.2.2.1.8′;
my $OID_ifHighSpeed     = ‘.1.3.6.1.2.1.31.1.1.1.15′;

my $ifTotal = 0;
my @ifList;
my @ifType;
my @ifMtu;
my @ifSpeed;

my @ifHighSpeed;
my @ifAdminStatus;
my @ifOperStatus;

my $hostname;
my $snmpcommunity;
my $snmpport;

my $OKresultstring = undef;

my
%ERRORS=(‘OK’=>0,’WARNING’=>1,’CRITICAL’=>2,’UNKNOWN’=>3,’DEPENDENT’=>4)
;

GetOptions(
“hostname=s”        => \$hostname,
“community=s”      => \$snmpcommunity,
“h=s”                         => \$hostname,
“C=s”                         => \$snmpcommunity,
“p:i”                           => \$snmpport,
“port:i”                      => \$snmpport,

);

my ($session, $error) = Net::SNMP->session(
-hostname        => $hostname || ‘localhost’,
-community      => $snmpcommunity || ‘public’,
-port                    => $snmpport || 161,
);

if (!defined($session)) {
printf(“ERROR: %s.\n”, $error);
exit $ERRORS{“UNKNOWN”};
}

sub get_ifTotal{
my $result = $session->get_request(-varbindlist => [
$OID_ifTotal ],);

if (!defined $result) {
printf “ERROR: %s.\n”, $session->error();
$session->close();
exit $ERRORS{“UNKNOWN”};
} else {
$ifTotal = $result->{$OID_ifTotal};

for (my $i=1; $i < $ifTotal+1; $i++) {
push(@ifList,           $OID_ifDescr.”.$i”);
push(@ifType,           $OID_ifType.”.$i”);
push(@ifMtu,            $OID_ifMtu.”.$i”);
push(@ifSpeed,          $OID_ifSpeed.”.$i”);
push(@ifAdminStatus,    $OID_ifAdminStatus.”.$i”);
push(@ifOperStatus,     $OID_ifOperStatus.”.$i”);
push(@ifHighSpeed,      $OID_ifHighSpeed.”.$i”);

}
}
}

sub get_snmpcardinfo{

$OKresultstring = “”;

for (my $i=0; $i < $ifTotal; $i++) {

my $result = $session->get_request(-varbindlist => [
$ifList[$i] ],);
$OKresultstring = “\n$OKresultstring Device – “.
$result->{$ifList[$i]};

$result = $session->get_request(-varbindlist => [
$ifType[$i] ],);
$OKresultstring = “\n$OKresultstring Type – “.
$result->{$ifType[$i]};

$result = $session->get_request(-varbindlist => [
$ifMtu[$i] ],);
$OKresultstring = “\n$OKresultstring Mtu – “.
$result->{$ifMtu[$i]};

$result = $session->get_request(-varbindlist => [
$ifOperStatus[$i] ],);
$OKresultstring = “\n$OKresultstring OperStatus – “.
$result->{$ifOperStatus[$i]};

my $result = $session->get_request(-varbindlist => [
$ifSpeed[$i] ],);
$OKresultstring = “\n$OKresultstring Speed – “.
$result->{$ifSpeed[$i]};

$result = $session->get_request(-varbindlist => [
$ifAdminStatus[$i] ],);
$OKresultstring = “\n$OKresultstring AdminStatus – “.
$result->{$ifAdminStatus[$i]};

}
$OKresultstring =~ s/^\s+//;
printf (“OK: %s”,$OKresultstring );
exit $ERRORS{“OK”};
}
get_ifTotal();
get_snmpcardinfo();
$session->close();
exit 0;

 

snmpinfo, a new nagios plugin

September 21st, 2010 § Leave a Comment

Had some fun (see the picture) creating a new snmp plugin. I always wondered if it would not be possible to get all of the ethernet devices in a device and get the complete info about the mtu size, the oper/admin status, etc.. Currently the base works in Nagios, it shows the complete information and return’s an error when an snmp session could not be established or shows an OK when it is possible to get the status.

Next thing to do is toy around with the Getopt::…. options to make sure you can be warned once a named device is down.

It currently works on debian pc’s. Will give it a try at windows pc/servers and other stuff like HP-UX, Cisco, etc…

Update: 22 September

Tested it on Cisco, MSA storage, Vmware ESX, etc… It seems they are all using a good snmp implementation. Will start cleaning up the code and release it as GPL soon.

perl, snmp en Nagios

September 15th, 2010 § Leave a Comment

De afgelopen maanden ben ik voor Nagios veel in de weer geweest met de check_snmp plugin. Een leuke plugin waar je veel informatie mee kunt ophalen. Punt is wel dat je nogal beperkt bent in de opties die je eigenlijk zou willen hebben. Ben daarom ook maar eens zelf gaan knutselen en heb mijn basis in 2 avondjes wel af.

./snmpinfo.pl
Mtu – 16436 Device – lo OperStatus – 1 Speed – 10000000 AdminStatus – 1 Type – 24
Mtu – 1500 Device – eth0 OperStatus – 1 Speed – 10000000 AdminStatus – 1 Type – 6
Mtu – 1500 Device – wlan0 OperStatus – 2 Speed – 10000000 AdminStatus – 1 Type – 6
Mtu – 1500 Device – vboxnet0 OperStatus – 2 Speed – 10000000 AdminStatus – 2 Type – 6

Wat ik o.a. wil bereiken is dat ik naar een device (pc, server, cisco geval) wil wijzen en in 1 plugin aanvraag wil kunnen zien wat er wel en niet op draait. Daarbij wil ik ook informatie over het ifType, de mtu, de snelheid, de errors, etc… zien, ongeacht of een netwerk verbinding nu werkt of niet. Ook wil ik in de argumenten kunnen meegeven welke verbinding open/dicht _moet_ staan.

Moet nog even wat argument zaken doornemen maar dan heb ik weer een nieuwe plugin. Een aanvulling heb ik ook al bedacht, wil eens kijken of ik een routering kan checken.

Where Am I?

You are currently browsing the nagios category at Zomaar ... maar dan anders.

Follow

Get every new post delivered to your Inbox.