#! /usr/bin/perl -w # # check_gfs_counters v1.1 plugin for Nagios # # returns values under Absolute from "gfs_tool counters" for trending purposes # # Copyright (C) 2006 Garrett Honeycutt # # 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. # # History: # # v1.1 Garrett Honeycutt - gh@3gupload.com # + cleanup # # v1.0 Garrett Honeycutt - gh@3gupload.com # + initial release # use strict; use FindBin; use lib $FindBin::Bin; use utils qw($TIMEOUT %ERRORS &print_revision &support); use vars qw($PROGNAME $PROGVER); use Getopt::Long; use vars qw($opt_V $opt_h $opt_p); $PROGNAME = "check_gfs_counters"; $PROGVER = "1.1"; sub print_help (); sub print_usage (); Getopt::Long::Configure('bundling'); GetOptions ("V" => \$opt_V, "version" => \$opt_V, "h" => \$opt_h, "help" => \$opt_h, "p=s" => \$opt_p, "partition=s" => \$opt_p); if ($opt_V) { print_revision($PROGNAME,'$Revision: '.$PROGVER.' $'); exit $ERRORS{'UNKNOWN'}; } if ($opt_h) { print_help(); exit $ERRORS{'UNKNOWN'}; } print_usage() unless ($opt_p); my $partition = $opt_p; my @gfs_tool_output = split(" ", `/sbin/gfs_tool counters $partition`); my $locks = $gfs_tool_output[3]; my $locks_held = $gfs_tool_output[7]; my $incore_inodes = $gfs_tool_output[11]; my $unlinked_inodes = $gfs_tool_output[15]; my $quota_ids = $gfs_tool_output[19]; my $incore_log_buffers = $gfs_tool_output[24]; my $log_space_used = $gfs_tool_output[29]; my $mh_cache_entries = $gfs_tool_output[34]; my $glock_deps = $gfs_tool_output[38]; my $glocks_on_reclaim_list = $gfs_tool_output[44]; my $log_wraps = $gfs_tool_output[48]; printf("OK: gfs_tool counters | 'locks'=%s 'locks_held'=%s 'incore inodes'=%s 'unlinked inodes'=%s 'quota IDs'=%s 'incore log buffers'=%s 'log space used'=%s 'mh cache entries'=%s 'glock dependencies'=%s 'glocks on reclaim list'=%s 'log wraps'=%s\n",$locks, $locks_held, $incore_inodes, $unlinked_inodes, $quota_ids, $incore_log_buffers, $log_space_used, $mh_cache_entries, $glock_deps, $glocks_on_reclaim_list, $log_wraps); exit $ERRORS{'OK'}; sub print_usage () { print "Usage: $PROGNAME -p [-h]\n"; exit $ERRORS{'UNKNOWN'} unless ($opt_h); } sub print_help () { print_revision($PROGNAME,'$Revision: '.$PROGVER.' $'); print "Copyright (c) 2006 Garrett Honeycutt\n"; print "\n"; print_usage(); print "\n"; print "-p \n"; print "-h = This screen.\n\n"; my_support(); } sub my_support () { print "Send email to nagios-plugins\@3gupload.com if you have questions regarding\nuse of this software, to submit patches, or suggest improvements.\n"; }