Solved! I used SNMP Traps like this:
In the (Debian) server:
# This file controls the activity of snmpd and snmptrapd
# Don't load any MIBs by default.
# You might comment this lines once you have the MIBs downloaded.
# snmpd control (yes means start daemon).
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-x -Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
# snmptrapd control (yes means start daemon). As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run. See snmpd.conf(5) for how to do this.
# snmptrapd options (use syslog).
TRAPDOPTS='-On -Lsd -p /var/run/snmptrapd.pid'
# create symlink on Debian legacy location to official RFC path
authCommunity execute public
traphandle .126.96.36.199.4.1.2021.991.17 /root/FindMac.sh
echo $mac > /root/log.txt
The MAC will be stored at "/root/log.txt", now you only have to write the script to do what ever you need...
In the client:
snmptrap -v 2c -c public [SERVER_IP_OR_HOSTNAME] '' NOTIFICATION-TEST-MIB::demo-notif SNMPv2-MIB::sysLocation.0 s "aa:bb:cc:dd:ee:ff"
After launching this, the file "/root/log.txt" in the server will contain "aa:bb:cc:dd:ee:ff".
1. The OID and MIB I used in this example aren't the correct ones, but it's working for my testing purposes.
2. The security in this example is TOO POOR.
I have to change this to port it to production environment.