$SCRIPT -|--f|F|FUN|function|FUNCTION -|--h|H|host|HOST -|--p|P|port|PORT -|--t|T|time|TIME|timeout -|--s|S|secret|SECRET -|--cl|CL|client|CLIENT -|--r|R|rad|RAD|radius|RADIUS|radiusattributes|RADIUSATTRIBUTES -|--a|A|attribute|ATTRIBUTE|attributevalues|ATTRIBUTESVALUES -|--del|delimiter -|--w|W|warn|WARN|warning|WARNING -|--c|C|crit|CRIT|critical|CRITICAL -|--v|V|VERSION |version -|--he|HE|help|HELP -|--d|D|DEBUG|debug ./$SCRIPT -F auth -host 10.10.10.1 -port 1812 -TIMEOUT 8 -SECRET testing123 -RADIUSATTR User-Name;NAS-Port-Id;ADSL-Agent-Circuit-Id;NAS-IP-Address \ -ATTRIBUTESVALUES "alex;pw-285:102;'10.13.3.22 eth_1/0/14';10.10.10.1" -CLIENT /usr/bin/radclient -W 5 -C 10 -DEBUG ./$SCRIPT -Function status -host 192.168.34.2 -port 1812 -TIMEOUT 8 -secret testing123 -CLIENT /usr/bin/radclient -WARNING 1 -CRITICAL 8 --DEBUG ./$SCRIPT -FUNC acct -h 10.10.10.1 -p 1813 -T 8 -S testing123 -radattributes -ATTRIBUTESVALUES -CLIENT /usr/bin/radclient -W 5 -C 10 ./$SCRIPT -Function status -host 192.168.34.2 -port 1812 -TIMEOUT 8 -secret testing123 -CLIENT /usr/bin/radclient -WARNING 1 -CRITICAL 8 --DEBUG ./$SCRIPT --help ./$SCRIPT --version -|--f|F|FUN|FUNCTION|function Function input is MANDATORY. Can be either auth, acct or status. Use function AUTH to send an authentication packet (Access-Request), function ACCT to send an accounting packet (Accounting-Request), function STATUS to send an status packet (Status-Server). (No DEFAULT)" -|--h|H|host|HOST IP to radius server to query (DEFAULT localhost) -|--p|P|port|PORT Port on radius server to query (Default is 1812) -|--t|T|time|TIME|timeout Wait timeout seconds before deciding that the NAS has not responded to a request, and re-sending the packet. (DEFAULT 8). -|--s|S|secret|SECRET The shared secret for this client. It needs to be defined on the radius server side too, for the IP address you are sending the radius packets from (DEFAULT "testing123") -|--r|R|rad|RAD|radius|RADIUS|radiusattributes|RADIUSATTRIBUTES string of colon separated radius attributes.(Delimiter is default "," unless changed by passing in the flag -|--DELIMITER see section delimiter below for details) i.e "User-Name;NAS-Port-Id;ADSL-Agent-Circuit-Id;NAS-IP-Address". AS A HABIT make sure to double quote "" this string list into the script. (DEFAULT "Message-Authenticator") -|--a|A|attribute|ATTRIBUTE|attributevalues|ATTRIBUTESVALUES string of colon separated Values for above passed in RADIUSATTRIBUTES(Delimiter is default "," unless changed by passing in the flag -|--DELIMITER see section delimiter below for details) i.e alex;pw-285:102;"10.13.3.22 eth_1/0/14";10.10.10.1. AS A HABIT make sure to double quote "" this string list into the script. (DEFAULT 0x00) -|--del|delimiter In some cases the RADIUS Attributes values one needs to pass on to this script may contain default delimiter colon "," in its string values. Like in string holders like Calling-Station-Id, ADSL-Agent-Circuit-Id or ADSL-Agent-Remote-Id etc. And since we don't want to split those string values in the wrong places this is where one can change what delimiter is to be used. -|--cl|CL|client|CLIENT Path to "radclient" to use for the radius query i.e /usr/bin/radclient (DEFAULT "/usr/bin/radclient") -|--w|W|warn|WARN|warning|WARNING This will tell Nagios when to send a WARNING message. This value can only be specified as a integer, no decimals accepted. WARNING Threshold is in seconds, and if the respons time from the radius server exceeds Warning threshold then the program will exit with WARNING exit($ERRORS{'WARNING'}); (DEFAULT 3 sec) -|--c|C|crit|CRIT|critical|CRITICAL This will tell Nagios when to send a CRITICAL message. This value can only be specified as a integer, no decimals accepted. CRITICAL Threshold is in seconds and if the respons time from the radius server exceeds CRITICAL threshold then the program will exit with WARNING exit($ERRORS{'CRITICAL'}); (DEFAULT 7 sec ) -|--d|D|DEBUG|debug : Enable debugging (DEFAULT disabled) -|--he|HE|help|HELP Prints this help screen -|--v|V|VERSION|version Prints program version INFO: WARNING THRESHOLDS must be exceeded before any checks are done on CRITICAL THRESHOLDS! Also only use the debug flag from the CLI Nagios may be very confused by it. If you find any BUGs or have a suggestion on a feature or improvements then please drop a line to cocoon.is\@gmail.com IMPORTANT!! For this scripts to work with Nagios! This script needs to be able to find nagios supplied utils.pm file. Edit this file at the top of the file change "use lib qw( /usr/local/nagios/libexec );" to point to where you Nagios installation installed utils.pm. IF you get errors looking like "Global symbol "%ERRORS" requires explicit package name" Then it is a sure sign that your path to utils.pm is wrong. Values of radclient flags -c and -r are hardcoded in the script if one needs to change those VALUES then just edit this file and change where \$RADIUS_RESENDS = "1" and/or \$RADIUS_SENDS = "1" to whatever values is needed.