Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
code share

Radius External Monitor (Python)

Problem this snippet solves:

Note: This script works and is usable however currently the only issue is that for some unknown reason it fails authentication on valid credentials, but since it still gets a valid response from the Radius server it will still mark the pool member as up. This only occurs via a configured monitor using either variable or arguments, running the script via command line with the same arguments works.

This python script is an external monitor for radius that checks for any radius response in order to mark a pool member as up. If the connection times out the script does not output any response and as such will result in the member being marked as down.

The script strips of routing domain tags and the IPv6 padding of the Node IPs.

How to use this snippet:

Installation:

  • Import as an External Monitor Program File and name it however you want.
  • Get and copy python modules Six (six py) and Py-Radius (radius py) then copy them to a directory with suitable permissions such as the /config/eav directory.
  • If you're running python 2.6, which you probably will, then the radius module will need to be modified as per Code Mods section in the code below.

Monitor Configuration:

Set up a monitor with at the very least a valid SECRET, if you're looking to simply test whether the Radius server is alive and responding then the user account does not need to be valid. Valid Environment Variables are as follows:

  • DEBUG = 0, 1, 2 (Default: 0)
  • MOD_PATH = Directory containing the Python modules (Default: /config/eav)
  • SECRET = Radius server secret (Default: NoSecret)
  • USER = User account (Default: radius_monitor)
  • PASSWD = Account Password (Default: NoPassword)

Notes:

  • The configured environment variables can overridden using Arguments with TESTME as the first argument followed by the variables you want to override in the same format as above, eg. KEY=Value. This is usedful for troubleshooting and can be used to override the F5 supplied NODE_IP and NODE_PORT variables.
  • Log file location: /var/log/monitors
  • Debug level 2 outputs environment variables, command line arguments and radius module into the log file.
Tested on Version:
12.0