Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageshell
firstline1
titleeduroam_monitor_check.sh
linenumberstrue
#!/bin/sh
# Run a heartbeat
ip=<the IP address for your server>
s=<the secret for the client you created>
bssid=<the BSSID for your eduroam network, in a MAC format like 02:00:00:00:00:01>
# check that eapol_test works
if [[ -x /sbin/eapol_test ]]; then
  if [[ -f /opt/eduroam_monitor/eapol_config.cfg ]]; then
    # get the actual output
    i=$(/sbin/eapol_test -t 5 -c /opt/eduroam_monitor/eapol_config.cfg -N 30:s:$bssid:eduroam -N 32:s:eduroamUKeduroam-heartbeatmonitor -a $ip -s $s |tail -1)
    # output is either success or failure
    /bin/logger eduroam Monitoring: $i
  fi
fi

...

Note

If you used a fake username (because your eduroam national operator didn't give you a username to use), you would see a FAILURE message with this script every time.

In this case, change line 10 to this:

    i=$(/sbin/eapol_test -t 5 -c /opt/eduroam_monitor/eapol_config.cfg -N 30:s:$bssid:eduroam -N 32:s:eduroamUKeduroam-heartbeat monitor -a $ip -s $s |tail -15 |grep 'CTRL-EVENT-EAP-FAILURE EAP authentication failed')

...

Code Block
languagetext
firstline1
titleeduroam_mon.bat
linenumberstrue
@echo off
set ROAMING_IP="<the IP address for your server>"
set ROAMING_SECRET="<the secret for the client you created>"
set BSSID="<the BSSID for your eduroam network, in a MAC format like 02:00:00:00:00:01>"
cd C:\eduroamHB
eapol_test.exe -t 5 -c eapol_config.cfg -N 30:s:%BSSID%:eduroam -N 32:s:eduroamUKeduroam-heartbeatmonitor -a %ROAMING_IP% -s %ROAMING_SECRET% |findstr /R "^SUCCESS$" >nul 2>nul
set MYVAR=%errorlevel%
IF "%MYVAR%" == "0" GOTO EventSuccess
eventcreate /Id 2 /D "eduroam Monitoring: FAILURE" /T ERROR /L system /SO eduroamMonitor >nul 2>nul
GOTO End
:EventSuccess
eventcreate /Id 1 /D "eduroam Monitoring: SUCCESS" /T SUCCESS /L system /SO eduroamMonitor >nul 2>nul
:End

...

Note

If you used a fake username (because your eduroam national operator didn't give you a username to use), you would see a FAILURE message with this script every time.

In this case, change line 6 to this:

eapol_test.exe -t 5 -c eapol_config.cfg -N 30:s:%BSSID%:eduroam -N 32:s:eduroamUKeduroam-heartbeat monitor -a %ROAMING_IP% -s %ROAMING_SECRET% |findstr /R "^EAP: Received EAP-Failure$" >nul 2>nul

...