[Nagiosplug-devel] [ nagiosplug-New Plugins-1087567 ] New plugin - check_tacacs_plus

SourceForge.net noreply at sourceforge.net
Sat Dec 18 08:14:02 CET 2004


New Plugins item #1087567, was opened at 2004-12-18 16:13
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=541465&aid=1087567&group_id=29880

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Cooper (gollum)
Assigned to: Nobody/Anonymous (nobody)
Summary: New plugin - check_tacacs_plus

Initial Comment:
#!/usr/bin/perl -w
#
# $Hashbang: check_tacacs_plus.pl,v 1.2 2004/12/15
15:42:01 pfarmer Exp $
#
# Copyright Notice: GPL
#
# $Id: check_tacacs_plus.pl,v 1.2 2004/12/15 15:42:01
pfarmer Exp $
#

use strict;
use lib "/usr/local/nagios/libexec";
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use Authen::TacacsPlus;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_H $opt_t $opt_k $opt_u
$opt_p $verbose
$PROGNAME);


$PROGNAME = "check_tacacs_plus";
sub print_help ();
sub print_usage ();

Getopt::Long::Configure('bundling');
GetOptions(
        "V"   => \,  "version"    => \,
        "h"   => \,  "help"       => \,
        "t=i" => \,  "timeout=i"  => \,
        "H=s" => \,  "hostname=s" => \,
        "k=s" => \,  "key=s"      => \,
        "u=s" => \,  "username=s" => \,
        "p=s" => \,  "password=s" => \,
        "v"   => \,"verbose"    => \
);

if ($opt_V) {
        print_revision($PROGNAME,'$Revision: 1.2 $ ');
        exit $ERRORS{'OK'};
}

if ($opt_h) {
        print_help();
        exit $ERRORS{'OK'};
}

if (!$opt_H) { 
        print "Host missing!\n";
        print_usage();
        exit $ERRORS{'UNKNOWN'};
}

if (!$opt_k) { 
        print_usage();
        exit $ERRORS{'UNKNOWN'};
}

if (!$opt_u) { 
        print_usage();
        exit $ERRORS{'UNKNOWN'};
}

if (!$opt_p) { 
        print_usage();
        exit $ERRORS{'UNKNOWN'};
}

if (!$opt_t) {
        $opt_t = 60;
}

my $tac = new Authen::TacacsPlus(Host => $opt_H, Key =>
$opt_k, Timeout
=> $opt_t);
unless ($tac){
        print "CRITICAL:
",Authen::TacacsPlus::errmsg(),"\n";
        exit $ERRORS{'CRITICAL'};
}
if ($tac->authen($opt_u,$opt_p)){
        print "OK: Tacacs Authentication OK\n";
        exit $ERRORS{'OK'};
} else {
        print "WARNING:
",Authen::TacacsPlus::errmsg(),"\n";
        exit $ERRORS{'WARNING'};
}
$tac->close();


sub print_help() {
        print_revision($PROGNAME,'$Revision: 1.2 $ ');
        print "Copyright (c) 2004 Peter Farmer/Mark
Cooper\n";
        print "\n";
        print "Check if a tacacs service is running and
that a user can
authenticate\n";
        print "\n";
        print_usage();
        print "\n";
        print "  <host>     The server providing the
tacacs service\n";
        print "  <key>      The tacacs key\n";
        print "  <user>     A username that will
authenticate OK with tacacs\n";
        print "  <password> The password for <user>\n";
        print "\n";
        support();
}

sub print_usage () {
        print "Usage: \n";
        print " $PROGNAME -H host -k key -u user -p
password\n";
        print " $PROGNAME [-h | --help]\n";
        print " $PROGNAME [-V | --version]\n";
}


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=541465&aid=1087567&group_id=29880




More information about the Devel mailing list