Contact Info

Crumbtrail

ActiveXperts.com » Network Monitor » Scripts » Custom Script

radius.vbs - vbscript script by ActiveXperts Software

radius.vbs checks a RADIUS server for accessibility.

Use radius.vbs directly from ActiveXperts Network Monitor; in the Manager's 'Monitor' menu, select 'New Check (Script)' and select radius.vbs. Configure the required parameter, or press 'Load a working sample'.

In ActiveXperts Network Monitor, Administrators can use three different scripting languages: Powershell, VBScript and SSH.


radius.vbs script code

' ///////////////////////////////////////////////////////////////////////////////
' // ActiveXperts Network Monitor  - VBScript based checks
' // For more information about ActiveXperts Network Monitor and VBScript, visit
' // http://www.activexperts.com/support/network-monitor/online/vbscript/
' ///////////////////////////////////////////////////////////////////////////////

Option Explicit

' Declaration of global variables
Dim   SYSDATA, SYSEXPLANATION   ' SYSDATA is displayed in the 'Data' column in the Manager; SYSEXPLANATION in the 'LastResponse' column

' Constants - return values
Const retvalUnknown = 1         ' ActiveXperts Network Monitor functions should always return True (-1, Success), False (0, Error) or retvalUnknown (1, Uncertain)

' // To test a function outside Network Monitor (e.g. using CSCRIPT from the
' // command line), remove the comment character (') in the following lines:
' Dim bResult
' bResult = Ping( "www.activexperts.com", 160 )
' WScript.Echo "Return value: [" & bResult & "]"
' WScript.Echo "SYSDATA: [" & SYSDATA & "]"
' WScript.Echo "SYSEXPLANATION: [" & SYSEXPLANATION & "]"


Function CheckRadius( strHost, strUser, strPassword, strSecret )
' Description:
'     Check a RADIUS server for accessibility
'     This function uses ActiveXperts Network Component.
'     ActiveXperts Network Component is automatically licensed when ActiveXperts Network Monitor is purchased
'     For more information about ActiveXperts Network Component, see: www.activexperts.com/network-component
' Parameters:
'     1) strHost - Host name or IP address of the RADIUS server
'     2) strUser - RADIUS User
'     3) strPassword - Password of the RADIUS user
'     4) strSecret - RADIUS secret
' Usage:
'     CheckRadius( "<Host>", "<User>", "<Password>", "<Secret>" )
' Sample:
'     CheckRadius( "srv202.activexperts-labs.com", "demo", "demo", "AxSecret" )

  Dim objRadius

  CheckRadius         = retvalUnknown  ' Default return value
  SYSDATA             = ""             ' Not used by this function
  SYSEXPLANATION      = ""             ' Set initial value

  Set objRadius = CreateObject("AxNetwork.Radius")

  ' Use default port 1812
  objRadius.Port           = 1812

  ' Login
  objRadius.CheckAccess strHost, strUser, strPassword, strSecret
  If( objRadius.LastError = 0 ) Then
    CheckRadius     = True
    SYSEXPLANATION  = "RADIUS server accessible"
  Else
    CheckRadius     = False
    SYSEXPLANATION  = "Failed to access RADIUS server; result=[" & objRadius.LastError & ": " & objRadius.GetErrorDescription( objRadius.LastError ) & "]"
  End If

End Function