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