$isRadiusRunning = 'true' === $util->setMenu('/radius incoming')->get(null, 'accept');
if ($isRadiusRunning) {
//RADIUS server (i.e. User Manager) is working
} else {
//RADIUS server (i.e. User Manager) is not working
}
try
{
$client = new RouterOS\Client( "xxx.xxx.xxx.xxx", "username", "password");
}
catch (RouterOS\DataFlowException $e)
{//In this try block's case, invalid credentials is the only possibility
echo $e->getMessage();
}
catch (RouterOS\SocketException $e)
{
//In this try block's case, connection failure is one of two possibilities,
//the other being that you're connecting to a different kind of service (e.g. if you have an HTTP server at that port)
$previous = $e->getPrevious();
if ($previous instanceof \Exception)
{
echo = "{$previous->getSocketErrorNumber()}: {$previous->getSocketErrorMessage()}" . "\n";
}
else
{
echo = $e->getMessage();
}
}
new RouterOS\Client( "xxx.xxx.xxx.xxx", "username", "password", null, false, 10);
I forgot to ask... is this the same as radtest from this guide https://wiki.freeradius.org/guide/Radtest ?Checking RouterOS itself is as simple as making a connection attempt.
To check if User Manager is accepting connections, once you make a connection with the API, you can doCode: Select all$isRadiusRunning = 'true' === $util->setMenu('/radius incoming')->get(null, 'accept'); if ($isRadiusRunning) { //RADIUS server (i.e. User Manager) is working } else { //RADIUS server (i.e. User Manager) is not working }