CESNET / rad_eap_test

Nagios compatible shell script used for testing RADIUS servers by EAP
GNU General Public License v2.0
18 stars 15 forks source link

cleanup temporary files #6

Open lager1 opened 6 years ago

lager1 commented 6 years ago

When running rad_eap_test from icinga and reloading the icinga process, some of the running tests still get killed and don't delete temporary files.

In icinga2 log there is:

[2018-08-03 13:00:58 +0200] warning/PluginCheckTask: Check command for object 'radius1.cuni.cz!PING' (PID: 24108, arguments: '/usr/lib/nagios/plugins/check_ping' '-4' '-H' 'radius1.cuni.cz' '-c' '200,15%' '-w' '100,5%') terminated with exit code 128, output: <Terminated by signal 15 (Terminated).>

Any thoughts on how can i simulate this to determine where exactly the problem is? From the part of the log above, it seems that the ping command itself terminates. Could this be the same with rad_eap_test?

lager1 commented 6 years ago

I've looked into this and tried two main possibilities:

Can be simulated by running some check in icingaweb2 and concurrently running

line=$(ps aux | grep eapol_test | grep tested-realm.cz); pid=$( echo $line | awk '{ print $2 }'); kill -INT $pid; echo $line

Tried this with signals INT, TERM, KILL.

In all cases rad_eap_test returns information about probable configuration error and does not intentionally delete temporary files.

Can be simulated by running some check in icingaweb2 and concurrently running

line=$(ps aux | grep rad_eap | grep tested-realm.cz); pid=$( echo $line | awk '{ print $2 }'); kill -INT $pid; echo $line

Tried this with signals INT, TERM, KILL.

When sending INT or TERM, the check status in icingaweb changes to CRITICAL with no output. All the temporary files are removed.

When sending KILL, the status in icingaweb is UNKNOWN and plugin output is <Terminated by signal 9 (Killed).>. The temporary files still exist. In icinga2 log there is:

[2018-08-16 11:11:49 +0200] warning/Process: PID 20285 was terminated by signal 9 (Killed)
[2018-08-16 11:11:49 +0200] warning/PluginCheckTask: Check command for object 'radius1.vse.cz!@agro-skola.cz' (PID: 20285, arguments: '/usr/lib/nagios/plugins/rad_eap_test' '-H' 'x' '-M' 'x' '-P' '1812' '-S' 'x' '-e' 'PEAP' '-i' 'x' '-m' 'WPA-EAP' '-p' 'x' '-t' '50' '-u' 'x') terminated with exit code 128, output: <Terminated by signal 9 (Killed).>

This seems to be the problematic case.