A
download check_inodes.pl
Language: Perl
LOC: 32
Project Info
pkg-nagios
Server: Debian-SVN
Type: svn
...ugins\tags\1.4.2‑1\contrib\
   check_adptraid.sh
   check_apache.pl
   check_apc_ups.pl
   check_appletalk.pl
   check_arping.pl
   check_asterisk.pl
   check_axis.sh
   check_backup.pl
   check_bgpstate.pl
   check_breeze.pl
   check_cluster.c
   check_cluster2.c
   check_compaq_insight.pl
   check_cpqarray.c
   check_digitemp.pl
   check_disk_snmp.pl
   check_dlswcircuit.pl
   check_dns_random.pl
   check_email_loop.pl
   check_flexlm.pl
   check_hltherm.c
   check_hprsc.pl
   ...th-client-certificate.c
   check_hw.sh
   ...k_ica_master_browser.pl
   ...a_metaframe_pub_apps.pl
   ...program_neigbourhood.pl
   check_inodes-freebsd.pl
   check_inodes.pl
   check_ipxping.c
   check_javaproc.pl
   check_joy.sh
   check_linux_raid.pl
   check_lmmon.pl
   check_log2.pl
   check_lotus.pl
   check_maxchannels.pl
   check_maxwanstate.pl
   check_mem.pl
   check_ms_spooler.pl
   check_mssql.sh
   check_nagios.pl
   check_nagios_db.pl
   check_nagios_db_pg.pl
   check_netapp.pl
   check_nmap.py
   check_ora_table_space.pl
   check_oracle_instance.pl
   check_pcpmetric.py
   check_qmailq.pl
   check_rbl.c
   ...remote_nagios_status.pl
   check_rrd_data.pl
   check_sap.sh
   check_smart.pl
   check_smb.sh
   check_snmp_disk_monitor.pl
   check_snmp_printer.pl
   ...snmp_process_monitor.pl
   check_snmp_procs.pl
   check_sockets.pl
   check_timeout.c
   ...traceroute-pure_perl.pl
   check_traceroute.pl
   check_uptime.c
   check_vcs.pl
   check_wave.pl
   check_wins.pl
   checkciscotemp.pl
   mrtgext.pl
   nagios_sendim.pl
   packet_utils.pm
   restrict.pl
   sched_downtime.pl
   urlize.pl
   utils.py

#!/usr/bin/perl 
##############################################################################
# This plugin uses df to gather filesystem statistics and check the percent  #
# used of inodes.  I've put a switch in here since i've got both aix and     #
# linux systems...adjust for your syntax's results.                          #
# Note: the percentages passed in MUST NOT have % after them                 #
# No warranty is either implied, nor expressed herein.                       #
#                                                                            #
##############################################################################

$filesystem = $ARGV[0];
$warnpercent = $ARGV[1];
$critpercent = $ARGV[2];

#------Find out what kind of syntax to expect
$systype=`uname`;
chomp($systype);

#------Make sure we got called with the right number of arguments
#------you could also put a check in here to make sure critical level is
#------greater than warning...but what the heck.
die "Usage: check_inodes filesystem warnpercent critpercent" unless @ARGV;

if ($#ARGV < 2) {
  die "Usage: check_inodes filesystem warnpercent critpercent";
}#end if

#------This gets the data from the df command
$inputline = `df -i $filesystem|grep -v "Filesystem"`;

#------replaces all spaces with a single :, that way we can use split
$inputline =~ y/ /:/s;

#------different oses give back different sets of columns from the df -i
#------(at least mine do).  This way I can use this plugin on all my hosts
#------if neither of these work, add your own in, or if you've got one that
#------just flat out reports something different...well...perl is your friend.
SWITCH: {
  if ($systype eq "Linux") {
    ($fs,$inodes,$iused,$ifree,$ipercent,$mntpt) = split(/:/,$inputline); 
    last SWITCH;
  }#end if
  if ($systype eq "AIX") {
    ($fs,$blks,$free,$percentused,$iused,$ipercent,$mntpt) = split(/:/,$inputline); 
    last SWITCH;
  }#end if
}#end switch

#------First we check for critical, since that is, by definition and convention
#------going to exceed the warning threshold
$ipercent =~ y/%//ds;

if ($ipercent > $critpercent) {
  print "CRITICAL: $filesystem inode use exceeds critical threshold $critpercent ($ipercent)";
  exit 1;
}# end if

#------Next we check the warning threshold
if ($ipercent > $warnpercent) {
  print "WARNING: $filesystem inode use exceeds warning threshold $warnpercent ($ipercent)";
  exit 2;
}# end if


#------thanks to the magic of procedural programming, we figure if we got here,
#------everything MUST be fine.
print "$filesystem inode use within limits ($ipercent)";
exit 0;

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us