OPNsense Forum

English Forums => General Discussion => Topic started by: Webfeger on January 18, 2026, 10:39:48 AM

Title: dsnmasq dhcp-script
Post by: Webfeger on January 18, 2026, 10:39:48 AM
Hey there,

I want to monitor new dhcp leases with dynamic mappings.
I figured out that dnsmasq will start a script after new lease by using param "dhcp-script" in dhcp config file.
I didn't find a option to set this param on web gui. so where the config file of dnsmasq is place which i can use to add this param?

My plan is to write a script which will check the result against the dnsmasq host file and put the result ina logfile for monit

I'm using OPNsense since this weekend and i still have to figure out how i can optimize the monitoring.

Best regards
Webfeger
Title: Re: dsnmasq dhcp-script
Post by: Webfeger on January 18, 2026, 12:02:02 PM
I Did found the config file and wrote a script wich will post the results into a logfile.

Sadly i didn't figured out how i can make dnsmasq able to run perl. Thats my current result in dnsmasq logfile:

failed to execute /usr/local/bin/perl /home/dhcp_lease.pl: No such file or directory
Title: Re: dsnmasq dhcp-script
Post by: Patrick M. Hausen on January 18, 2026, 12:23:21 PM
Put this in the first line of /home/dhcp_lease.pl

#!/usr/local/bin/perl

and make the script file executable (chmod 755). The use only the script path in the configuration.
Title: Re: dsnmasq dhcp-script
Post by: Webfeger on January 18, 2026, 01:59:42 PM
Quote from: Patrick M. Hausen on Today at 12:23:21 PMPut this in the first line of /home/dhcp_lease.pl

#!/usr/local/bin/perl

and make the script file executable (chmod 755). The use only the script path in the configuration.

Thanks for help !! must have overseen that because there was already define, but wrong path. Now the script is working so far and monin is ready. Will take some tests.