ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] IPMI monitoring daemon
@ 2010-06-29 14:20 Gulay Boris
  2010-06-29 14:55 ` Денис Ягофаров
  2010-07-10 13:33 ` Michael Shigorin
  0 siblings, 2 replies; 3+ messages in thread
From: Gulay Boris @ 2010-06-29 14:20 UTC (permalink / raw)
  To: community

У меня сервер поддерживает IPMI. Я хотел бы, чтобы кто-нибудь периодически
запрашивал данные мониторинга (как минимум, температуру и скорости
вентиляторов) и слал мне сообщение, если что-то не так. Скажу даже больше -
в IPMI есть лимиты, которые влияют на статус датчика (Normal, Crytical и
т.п.), было бы здорово эти лимиты проверять и слать сообщение при
возникновении проблем.
То есть я хочу что-то вроде smartd из комплекта smarttools для IPMI.
Подскажите, пожалуйста.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] IPMI monitoring daemon
  2010-06-29 14:20 [Comm] IPMI monitoring daemon Gulay Boris
@ 2010-06-29 14:55 ` Денис Ягофаров
  2010-07-10 13:33 ` Michael Shigorin
  1 sibling, 0 replies; 3+ messages in thread
From: Денис Ягофаров @ 2010-06-29 14:55 UTC (permalink / raw)
  To: ALT Linux Community general discussions

[-- Attachment #1: Type: text/plain, Size: 6473 bytes --]

Добрый день.

Я применяю вот такой (немножко допиленный) скрипт для nagios:

#!/usr/bin/perl

# Nagios plugin for IPMI sensors status checking.
# Especially useful on Dell Poweredge servers, and others that
# implement the Intelligent Platform Management Interface (IPMI)
# interface.

# Tested against the 1850, 1950, 2850, 2950, SC1420, PE830 BMCs

#
# (C) Chris Wilson <check_ipmi@qwirx.com>, 2005-06-04
# Released under the GNU General Public License (GPL)

# Re-written by Bill Moran <wmoran@collaborativefusion.com>
# and Brian Seklecki <bseklecki@collaborativefusion.com>
# 06/20/06
# $Id: check_ipmi.pl 192 2007-04-11 19:51:33Z seklecki $


#/*
# * Copyright (c) 2006-2007 Collaborative Fusion, Inc.  All rights reserved.
# *
# * Developed by: Collaborative Fusion, Inc.
# *                                          
http://www.collaborativefusion.com
# *
# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
EXPRESS OR
# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# * COLLABORATIVE FUSION, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
# * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
LIMITED TO,
# * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
PROFITS;
# * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# */
#
#/*
# * This code was written under funding by Collaborative Fusion, Inc..
# */

# Strategy:
# Take a hostname (or IP) on the command line argv[1]
# e.g. check_ipmi.pl 10.1.1.1
# Look for a file in directory that matches the name
# i.e. ipmi_credentials_${1/hostname}
#
# Format of said file would be the username/password to use (syntax as 
passed
# on the command line of ipmitool(1) ) : $  "-U username -P password"
# NOTE: If not found, look for a generic "ipmi_credientials" file before 
failing

#use warnings;
use strict;

use lib "/usr/lib/nagios/plugins/";
use utils qw(%ERRORS $TIMEOUT);

# Watch your permissions here (because you know IPMI uses high encryption)
my $pwfile_prefix = '/etc/check_ipmi/passwd.';
my $monfile_prefix = '/etc/check_ipmi/mon.';
my $ipmitool = '/usr/bin/ipmitool';
my $command;
my %NAGIOS_API_ECODES = ( 'OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 
'UNKNOWN' => 3);
# default

my $USAGE="Usage Syntax: $0 [remoteHost]";

# define globally
#$nagios_ecode=$NAGIOS_API_ECODES{UNKNOWN};
my $nagios_ecode="NONE";
my $nagios_prefdata="";
my $nagios_retdata="";
$NAGIOS_API_ECODES{$nagios_ecode} = -1;

sub nagios_diode ($ $)  {

         (my $new_ecode, my $prefdata) = @_;


         # This fucntion is a one-way transition for the return code
         # it allow the global error code to increment upward only
         # it also concatenates the performance data

         # The tricky part is that we want to default to sane "3" uknown
         # but instead we'll have to default to -1 (out of bounds, coach)

         #print "DEBUG: new error code: " . $new_ecode . "\n";
         #print "DEBUG: new error code #: " . 
$NAGIOS_API_ECODES{$new_ecode} . "\n";
         #print "DEBUG: previous error code: " . $nagios_ecode . "\n";
         #print "DEBUG: previous error code #: " . 
$NAGIOS_API_ECODES{$nagios_ecode} . "\n";

         if ( $NAGIOS_API_ECODES{$new_ecode} gt 
$NAGIOS_API_ECODES{$nagios_ecode} ) {
                 #print "DEBUG: transitioning from: " . $nagios_ecode . 
" -> " . $new_ecode . "\n";
                 $nagios_ecode = $new_ecode;
         }

         #print "DEBUG: Appending pref data: " . $prefdata . "\n";
         $nagios_prefdata = $nagios_prefdata . "|" . $prefdata;

}

sub cane_one() {
         print $nagios_retdata;
         print $nagios_prefdata;
         exit $NAGIOS_API_ECODES{$nagios_ecode};
}

if ( scalar(@ARGV) < 1 || scalar(@ARGV) > 2 || $ARGV[0] !~ 
m/^[a-z0-9\.\-]+$/ ) {
         nagios_diode('UNKNOWN', $USAGE);
         cane_one;
} else {
         my $passwdfile;
         my $username="ADMIN";

         $passwdfile = "${pwfile_prefix}$ARGV[0]";

         if (! -r $passwdfile) {
                 $passwdfile = "${pwfile_prefix}default";
                 # set code to warning because using default passwd file
                 nagios_diode('WARNING', "WARNING: No credentials found 
for $ARGV[0] - trying to use default!");
         }
         $command = "$ipmitool -H $ARGV[0] -U $username -f $passwdfile 
sdr 2>&1 | grep -f $monfile_prefix$ARGV[0]";
#       $command = "cat /badvals 2>&1 | grep -f $monfile_prefix$ARGV[0]";
}

if (! open(IPMI, "$command |") ) {
          nagios_diode('UNKNOWN', "Unable to exec ipmitool(8)");
          cane_one;
}

#print("DEBUG:".$command."\r\n");

my %found;
my %bad;

sub trim ($) {
         my ($v) = @_;
         $v =~ s/^ +//;
         $v =~ s/ +$//;
         return $v;
}

while (my $line = <IPMI>)
{
         chomp $line;
         unless ($line =~ m'^(.*) \| (.*) \| (\w+)$')
         {
                 nagios_diode('CRITICAL', "Unrecognized response from 
ipmitool: $line");
                 cane_one;
         }

         my $name  = trim $1;
         my $value = trim $2;
         my $state = trim $3;
         $name =~ tr| |_|;

         my $counter = 1;
         my $uname = "$name";
         while ($found{$uname}) {
                 $uname = $name . $counter++;
         }

         next if $state eq "ns";

         if ($state ne "ok") {
                 $bad{$uname} = $state;
         }

         $found{$uname} = $value;
}

if (keys %bad) {

         my @bad;
         foreach my $name (sort keys %bad) {
                 push @bad, "$name is $bad{$name}";
         }
         $nagios_retdata = "CRITICAL:" . "(" . join(", ", @bad) . ") ";
         nagios_diode('CRITICAL', "IPMI Critical Value: ");


} else {
         $nagios_retdata = "OK.";
         nagios_diode('OK', "IPMI OK: ");
}

my @out;

# Directly toch pref_data - assume that iit is safe to


foreach my $name (sort keys %found) {
         next unless $name =~ m|Fan| or $name =~ m|Temp|;
         #print "DEBUG: $name = $found{$name}\n";
         #$nagios_prefdata = $nagios_prefdata. "$name = $found{$name},";
         push @out, "$name = $found{$name}";
}

$nagios_prefdata = $nagios_prefdata . "(" . join(", ", @out) . ") ";

cane_one;

[-- Attachment #2: denyago.vcf --]
[-- Type: text/x-vcard, Size: 370 bytes --]

begin:vcard
fn:Denis Timurovich Yagofarov
n:Yagofarov;Denis Timurovich
org:ITGIS NASU
adr:room 615;;Chokolovski blvdr., 13;Kiev;;03151;Ukraine
email;internet:denyago@rambler.ru
title:system administrator
tel;work:80445201209
tel;cell:80662933760
note;quoted-printable:xmmp: denyago@gmail.com=0D=0A=
	xmmp: diyago@jabber.te.ua
x-mozilla-html:FALSE
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] IPMI monitoring daemon
  2010-06-29 14:20 [Comm] IPMI monitoring daemon Gulay Boris
  2010-06-29 14:55 ` Денис Ягофаров
@ 2010-07-10 13:33 ` Michael Shigorin
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Shigorin @ 2010-07-10 13:33 UTC (permalink / raw)
  To: community

On Tue, Jun 29, 2010 at 06:20:06PM +0400, Gulay Boris wrote:
> У меня сервер поддерживает IPMI. Я хотел бы, чтобы кто-нибудь
> периодически запрашивал данные мониторинга (как минимум,
> температуру и скорости вентиляторов) и слал мне сообщение,
> если что-то не так.

Гляньте ещё ipmievd(8) из ipmitool, он умеет не в сислог,
а в stdout/stderr события валить.

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-10 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29 14:20 [Comm] IPMI monitoring daemon Gulay Boris
2010-06-29 14:55 ` Денис Ягофаров
2010-07-10 13:33 ` Michael Shigorin

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git