# ---------------------------------------------------------------
# radius
# ---------------------------------------------------------------
# 
# Description
# 
# This module is used to query a radius server and attempt to 
# authenticate a user.  It utilizes the Authen::Radius module
# which is available from CPAN.
# 
# Parameters
# 
# secret	The shared secret to use when contacting the server
# port	The port your server is running on (default: 1645)
# user	The username to authenticate
# pass	The password to use
# item	The item to report (default: radius)
# time	The number of seconds to wait for a response before
# 		timing out.  (default: 5)
# 
# Kevin O'Donnell
# Vancouver, Canada
# kevin_odonnell@telus.net
# 
# ---------------------------------------------------------------

# Load the monitor
my $radius;
unless( $radius = $memory{"radius"} ) {
    &uxmon::load_module( "radius" );
    &uxmon::checker(
        $memory{"radius"} = $radius = Monitor::radius->new()
    );
}

my $host = $args{host} ? $args{host} : $args{alias};
my $secret = $args{secret};
my $port = $args{port};
my $user = $args{user};
my $pass = $args{pass};
my $item = $args{item} ? $args{item} : 'radius';
my $time = $args{time} ? $args{time} : 5;
$item = "$args{alias}.$item";

$radius->add($host,$secret,$port,$user,$pass,$item,$time);
