aboutsummaryrefslogtreecommitdiff
path: root/contrib/aix
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/aix')
-rw-r--r--contrib/aix/check_crit_dsk66
-rw-r--r--contrib/aix/check_dsk62
-rw-r--r--contrib/aix/check_failed48
-rw-r--r--contrib/aix/check_io69
-rw-r--r--contrib/aix/check_kerberos49
-rw-r--r--contrib/aix/check_ping117
-rw-r--r--contrib/aix/check_queue67
-rw-r--r--contrib/aix/pg_stat45
8 files changed, 523 insertions, 0 deletions
diff --git a/contrib/aix/check_crit_dsk b/contrib/aix/check_crit_dsk
new file mode 100644
index 00000000..566e07c1
--- /dev/null
+++ b/contrib/aix/check_crit_dsk
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+#=========================================================================
+# Critical Disk Checker utility
+#
+# This is the same as the disk checker utility but we use it as
+# a seperate service in Nagios to report on partitions that
+# have reached 100% capacity.
+#
+# We have excluded /dev/cd0 because the cdrom drive will always
+# report 100% capacity if a CD is in the drive.
+#
+# Authors: TheRocker
+# SpEnTBoY
+#
+# Email: therocker@pawprints.2y.net
+# lonny@abyss.za.org
+#
+#=======================================================================
+
+NUMBER=`rsh $1 -l root df -kP | grep -vE ":|/dev/cd0" | grep -E "100%" | tr -s ' '| cut -d' ' -f5 | cut -c1-3 | line`
+TMPFILE=/tmp/tmpcrit.hndl
+TMPTOO=/tmp/twocrit.hndl
+
+if [ "$NUMBER" -eq 100 ]
+then
+
+ `rsh $1 -l root df -kP |grep -vE ":|/dev/cd0" | grep -E "100%" | tr -s ' '| cut -d' ' -f6,5 >> $TMPFILE`
+
+ LINES=`wc -l /tmp/tmpcrit.hndl | cut -c8`
+ LINESCTL=`wc -l /tmp/tmpcrit.hndl | cut -c8 `
+ echo "Filesystems over 99% --> \c"
+
+#===============================================================
+# Just a little bit to check for multiple occurances of the
+# condition.
+#===============================================================
+
+ while [ $LINESCTL != 0 ]
+ do
+
+ cat $TMPFILE | tail -$LINESCTL > $TMPTOO
+ cat $TMPTOO > $TMPFILE
+ LINESCTL=$(( $LINESCTL -1 ))
+ LINES=$(( $LINES -1 ))
+ DATA=`head -1 /tmp/tmpcrit.hndl`
+ echo "( $DATA ) \c"
+
+
+ done
+ echo "\n"
+
+#===============================================================
+# File clean up. Always pick up after yourself. Disk space
+# doesn't grow on trees you know.
+#===============================================================
+
+ rm -f $TMPFILE
+ rm -f $TMPTOO
+ exit 2
+
+else
+
+ echo "No Filesystems over 99%... OK"
+ exit 0
+fi
diff --git a/contrib/aix/check_dsk b/contrib/aix/check_dsk
new file mode 100644
index 00000000..c8ddb3f8
--- /dev/null
+++ b/contrib/aix/check_dsk
@@ -0,0 +1,62 @@
+#! /bin/sh
+
+#======================================================================
+# Disk Checker utility
+#
+# Simple little script that checks the status of all partitions
+# on a node's hard disks. It will produce a warning alert and list
+# the offending filesystems in nagios.
+#
+# Authors: SpEnTBoY
+# TheRocker
+#
+# Email: lonny@abyss.za.org
+# therocker@pawprints.2y.net
+#=====================================================================
+
+NUMBER=`rsh $1 -l root df -kP | grep -v ":" | grep -E "9[0-9]%" | tr -s ' '| cut -d' ' -f5 | cut -c1-2 | line`
+TMPFILE=/tmp/tmp.hndl
+TMPTOO=/tmp/two.hndl
+
+if [ "$NUMBER" -gt 90 ]
+then
+
+ `rsh $1 -l root df -kP |grep -v ":" | grep -E "9[0-9]%" | tr -s ' '| cut -d' ' -f6,5 >> $TMPFILE`
+
+ LINES=`wc -l /tmp/tmp.hndl | cut -c8`
+ LINESCTL=`wc -l /tmp/tmp.hndl | cut -c8 `
+ echo "Filesystems over 90% --> \c"
+
+#======================================================================
+# You'll see this one in a few our shell scripts. Just chcecking for
+# multiple occurances of the warnign condition. We gotta list 'em all
+#======================================================================
+
+ while [ $LINESCTL != 0 ]
+ do
+
+ cat $TMPFILE | tail -$LINESCTL > $TMPTOO
+ cat $TMPTOO > $TMPFILE
+ LINESCTL=$(( $LINESCTL -1 ))
+ LINES=$(( $LINES -1 ))
+ DATA=`head -1 /tmp/tmp.hndl`
+ echo "( $DATA ) \c"
+
+
+ done
+ echo "\n"
+
+#===============================================================
+# Clean up all those nasty tmp files that suck up valuable
+# disk realestate.
+#===============================================================
+
+ rm -f $TMPFILE
+ rm -f $TMPTOO
+ exit 1
+
+else
+
+ echo "No Filesystems over 90%... OK"
+ exit 0
+fi
diff --git a/contrib/aix/check_failed b/contrib/aix/check_failed
new file mode 100644
index 00000000..50cdf7e1
--- /dev/null
+++ b/contrib/aix/check_failed
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+#======================
+# Created May 25, 2000
+#======================
+
+# This scripts is for checking for failed root login attempts on
+# any machine running AIX which has a failedlogin file in /etc/security
+# The purpose is to thwart (good word) any unauthorised people from
+# even trying to log in as root. This plugin has been developed for Nagios
+# running on AIX.
+# Lonny Selinger SpEnTBoY lonny@abyss.za.org
+# May
+
+
+my $server = $ARGV[0];
+
+if (!$ARGV[0]) {
+ print "You must specify a server to check\n";
+ print "usage: ./check_failed <Server Name>\n";
+ exit (-1);
+ } else {
+ open (DATE, "/bin/date '+%b %d' |");
+ while (<DATE>) {
+ $dline = $_;
+ @dresults = $dline;
+ chop $dresults[0];
+ }
+ open (SULOG, "rsh $server -l root who /etc/security/failedlogin | grep root |");
+ while (<SULOG>) {
+ $line = $_;
+ @results = split (/\s+/,$line);
+ if ($line =~ /^root/) {
+ if (join(' ', @results[2,3]) eq $dresults[0]) {
+ print "FAILED root login on $dresults[0], node: $ARGV[0] from $results[5]\n";
+ exit(2);
+ }
+ }
+ }
+}
+if (join(' ', @results[2,3]) ne $dresults[0]) {
+ print "No Failed Root Logins on This Node\n";
+ exit(0);
+}
+exit(0);
+close(SULOG);
+close(DATE);
+
+
diff --git a/contrib/aix/check_io b/contrib/aix/check_io
new file mode 100644
index 00000000..58b25f6d
--- /dev/null
+++ b/contrib/aix/check_io
@@ -0,0 +1,69 @@
+#! /bin/sh
+
+#=================================================================
+#
+# I/O Checker (KBPS)
+# This Script uses iostat to monitor disk io
+# Useful for notifications of disk thrashing.
+#
+# Authors: TheRocker
+# SpEnTBoY
+#
+# Email: therocker@pawprints.2y.net
+# lonny@abyss.za.org
+#
+#================================================================
+
+NUMBER1=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c1 | line`
+NUMBER2=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c2 | line`
+TMPFILE=/tmp/iotest.hndl
+TMPTOO=/tmp/iotwo.hndl
+
+#===========================================================
+#
+# We do an evaluation on $NUMBER1 and $NUMBER2 to see if
+# disk io is exceeding 40%.
+#
+#===========================================================
+
+if [ "$NUMBER1" -gt 4 ] && [ "$NUMBER2" -gt 0 ]
+then
+
+ `rsh $1 -l root iostat -d | grep -v cd0 | tr -s ' '| cut -d' ' -f1,2 | grep -e "4[0-9]." >> $TMPFILE`
+
+#====================================================================
+#
+# Of course, there may be more than one hard disk on the node
+# so we use this bit of code to report on more than one instance
+# of excessive disk IO.
+#
+#====================================================================
+
+ LINES=`wc -l /tmp/iotest.hndl | cut -c8`
+ LINESCTL=`wc -l /tmp/iotest.hndl | cut -c8 `
+ echo "WARNING!!! Disk I/O Exceeding 40% on --> \c"
+
+ while [ $LINESCTL != 0 ]
+ do
+
+ cat $TMPFILE | tail -$LINESCTL > $TMPTOO
+ cat $TMPTOO > $TMPFILE
+ LINESCTL=$(( $LINESCTL -1 ))
+ LINES=$(( $LINES -1 ))
+ DATA=`head -1 /tmp/iotest.hndl`
+ echo "( $DATA ) "
+
+
+ done
+ echo "\n"
+
+ rm -f $TMPFILE
+ rm -f $TMPTOO
+ exit 1
+
+else
+
+ print "No Disk I/O Exceeding 40%...OK"
+ exit 0
+
+fi
diff --git a/contrib/aix/check_kerberos b/contrib/aix/check_kerberos
new file mode 100644
index 00000000..443ab109
--- /dev/null
+++ b/contrib/aix/check_kerberos
@@ -0,0 +1,49 @@
+#! /bin/sh
+
+#=========================================================================
+# Kerberos Ticket Checker
+#
+# This script is handy if you allow kerberos tickets to expire
+# on your nodes. The script will simply warn you when a node has
+# kerberos tickets expiring on the current date. This will allow to
+# re-initialize the tickets if you wish to do so.
+#
+# Nothing fancy here, all Nagios will show is the number of tickets
+# that are going to (or already have) expired.
+#
+# An item of note:
+#
+# We made no provisions for the weekend. If tickets expire on the
+# weekend and nobody is around, you won't see a warning on the
+# Nagios console because we look for expired on the current day
+# only. It's a good idea to have this warning emailed to the
+# appropriate admin and if there is something critical that relies
+# on Kerberos, you might want to send a page.
+#
+# Authors: TheRocker
+# SpEnTBoY
+#
+# Email: therocker@pawprints.2y.net
+# lonny@abyss.za.org
+#=========================================================================
+
+TMPFILE=/tmp/kerbtmp.hndl
+DATE=`date +%b' '%d`
+
+rsh $1 -l root /usr/lpp/ssp/kerberos/bin/klist | tr -s ' ' | cut -d' ' -f4,5,6 | grep -e "$DATE" > $TMPFILE
+
+
+if [ -s $TMPFILE ]
+then
+
+ LINES=`wc -l /tmp/kerbtmp.hndl | cut -c7-8`
+ echo "Kerberos Tickets set to expire --> \c"
+ echo "$LINES \c"
+ echo "\n"
+
+ rm -f $TMPFILE
+ exit 1
+
+fi
+ echo "Kerberos Tickets are valid"
+ exit 0
diff --git a/contrib/aix/check_ping b/contrib/aix/check_ping
new file mode 100644
index 00000000..aaa8c84e
--- /dev/null
+++ b/contrib/aix/check_ping
@@ -0,0 +1,117 @@
+#!/usr/bin/perl -w
+
+#================================================================
+#
+# This perl script will accept an argument and simply pass it
+# to ping. It works by sending 2 ping to the specified host
+# and evaluating on the average delta time of those 2 pings.
+#
+# Author: SpEnTBoY
+# Email: lonny@abyss.za.org
+# April 5,2000
+#
+#================================================================
+
+#============================
+# State predefined stuff and
+# requirements
+#============================
+
+require 5.004;
+use POSIX;
+use strict;
+
+sub usage;
+
+my $ipaddr = $ARGV[0];
+
+my $TIMEOUT = 15;
+
+my %ERRORS = ('UNKNOWN' , '-1',
+ 'OK' , '0',
+ 'WARNING', '1',
+ 'CRITICAL', '2');
+
+my $remote = shift || &usage(%ERRORS);
+my $warning = shift || 750;
+my $critical = shift || 1000;
+
+my $state = "OK";
+my $answer = undef;
+my $offset = undef;
+my $line = undef;
+
+#============================================================
+# If theres no response we can exit the bloody thing cleanly
+# last thing I want to do is hang an AIX system ;-)
+#============================================================
+
+$SIG{'ALRM'} = sub {
+ print ("ERROR: No response from PING! (alarm)\n");
+ exit $ERRORS{"UNKNOWN"};
+};
+alarm($TIMEOUT);
+
+#================================================
+# Pass stddn from $ARGV to the command and parse
+# the info we need (namely the value for "max"
+#================================================
+
+
+
+open(PING,"/usr/sbin/ping -c 2 '$ipaddr' >&1|");
+while (<PING>) {
+ $line = $_;
+ if (/round-trip min\/avg\/max = (.+)\/(.+)\/(.+) ms/) {
+ $offset = $3;
+ last;
+ }
+}
+
+#==================================================
+# Do some error checking on the output of the file
+# and implement values for <crit> and <warn>
+# deffinitions if they were specified by the user
+# or sub in the predefined ones
+#==================================================
+
+if (defined $offset) {
+ if (abs($offset) > $warning) {
+ if (abs($offset) > $critical) {
+ $state = "CRITICAL";
+ $answer = ": Ping Time $offset MS greater than +/- $critical MS\n";
+ } else {
+ $state = "WARNING";
+ $answer = ": Ping Time $offset MS greater than +/- $warning MS\n";
+ }
+ } else {
+ $state = "OK";
+ $answer = ": Ping Time $offset MS\n";
+ }
+} else {
+ $state = "UNKNOWN";
+ $answer = ": $line\n";
+}
+print ("$state$answer");
+exit $ERRORS{$state};
+
+sub usage {
+ print "\n";
+ print "#=========================================\n";
+ print "Check_Ping 0.02 script by Lonny Selinger\n";
+ print "Made with AIX in mind ;-)\n";
+ print "#=========================================\n";
+ print "\n";
+ print "#================================================\n";
+ print " I'm going to need a few more arguments from you\n";
+ print "#================================================\n";
+ print "\n";
+ print "#================================================\n";
+ print "Usage: check_ping <host> [<warn> [<crit>]\n";
+ print "#================================================\n";
+ print "\n";
+ print "<warn> = Ping in MS at which a warning message will be generated.\n Defaults to 750.\n";
+ print "<crit> = Ping in MS at which a critical message will be generated.\n Defaults to 1000.\n\n";
+ exit $ERRORS{"UNKNOWN"};
+}
+
diff --git a/contrib/aix/check_queue b/contrib/aix/check_queue
new file mode 100644
index 00000000..9f709c54
--- /dev/null
+++ b/contrib/aix/check_queue
@@ -0,0 +1,67 @@
+#! /bin/sh
+
+#===============================================================
+# Print Queue Checker
+#
+# The print queue checker simply looks for an occurance of a
+# DOWN queue. A note of warning, if you use remote queues in
+# AIX to redirect print jobs from the AIX queue to an NT print
+# server that print through DLC rather than IP, it will be very
+# s - l - o - w. But it will work.
+#
+# Author: TheRocker
+# Email: therocker@pawprints.2y.net
+#===============================================================
+
+TMPFILE=/tmp/qtmp.hndl
+TMPTOO=/tmp/qtwo.hndl
+
+#=======================================================================
+#
+# This script will also work on AIX 4.2.1 BUT you have to change
+# the following line. AIX 4.2.1 does not support the -W option
+# with lpstat. For AIX 4.2.1 just remove the -W option and it should
+# work just fine.
+#
+#=======================================================================
+
+`rsh $1 -l root lpstat -W | grep -e "DOWN" | tr -s ' ' | cut -d' ' -f1,3 > /tmp/qtmp.hndl 2> /tmp/q_err`
+
+if [ -s $TMPFILE ]
+then
+
+#=======================================================
+#
+# If you've seen the other AIX scripts I wrote you may
+# notice that I use this bit of code a lot. Well it
+# works and appears to be all purpose.
+#
+#=======================================================
+
+ LINES=`wc -l /tmp/qtmp.hndl | cut -c8`
+ LINESCTL=`wc -l /tmp/qtmp.hndl | cut -c8`
+
+ echo "Print Queue DOWN --> \c"
+
+ while [ $LINESCTL != 0 ]
+ do
+
+ cat $TMPFILE | tail -$LINESCTL > $TMPTOO
+ cat $TMPTOO > $TMPFILE
+ LINESCTL=$(( $LINESCTL -1 ))
+ LINES=$(( $LINES -1 ))
+ DATA=`head -1 /tmp/qtmp.hndl`
+ echo "( $DATA ) \c"
+
+
+ done
+
+ echo "\n"
+
+ rm -f $TMPFILE
+ rm -f $TMPTOO
+ exit 2
+
+fi
+ echo "Print Queues Running... OK"
+ exit 0
diff --git a/contrib/aix/pg_stat b/contrib/aix/pg_stat
new file mode 100644
index 00000000..e0603ec4
--- /dev/null
+++ b/contrib/aix/pg_stat
@@ -0,0 +1,45 @@
+#!/bin/ksh
+
+#==============================================================================
+# Script was originally created to collect stats and dump then to a log file
+# every five minutes. But we like this better (the log file thing is still
+# good if you want to track availability).
+#
+# Authors: SpEnTBoY
+# TheRocker
+#
+# Email: lonny@abyss.za.org
+# therocker@pawprints.2y.net
+#==============================================================================
+
+#=========================================================================================
+#
+# The best way to do this is to use Kerberos but we use rsh here because our monitoring
+# workstation doesn't have Kerberos installed. In order for this to work, the remote
+# host ($1) must have a .rhosts file that contains a line like:
+#
+# monitorhost nagiosuser
+#
+#=========================================================================================
+
+PAGING2=`rsh $1 -l root lsps -a -s | grep -v Paging | tr -s ' '| cut -d' ' -f3 | cut -d'%' -f1`
+
+
+if [ "$PAGING2" -gt "35" ] && [ "$PAGING2" -lt "50" ]
+then
+ echo "Paging Space is over 35% ("$PAGING2")%"
+exit 1
+fi
+
+if [ "$PAGING2" -gt "49" ]
+then
+ echo "WARNING! Paging Space is over 50% ("$PAGING2")%"
+exit 2
+fi
+
+if [ "$PAGING2" -lt "34" ]
+then
+ echo "Paging Space is less than 34% ("$PAGING2")%"
+exit 0
+fi
+