Hi folks
I would like to monitor the number of leases of my dhcp server (Ubuntu 20.04, isc-dhcp-server).
I tried to follow these:
- https://share.zabbix.com/cat-app/app-other/isc-dhcpd
- https://github.com/garbled1/zabbix_isc_dhcpd
I am not strong with Python, but so far, I figured out a few things:
- on dhcp-server: installed python3, pip3 and both pip-installs (pypureomapi and netaddr)
- had to migrate a few things to be conformant with Python3 (print "test" => print("test") and KEYNAME = 'omapi_key'.encode("utf-8")
When calling ./check_dhcp_leases.py, the parsed info from dhcpd.conf is returned. This also works from Zabbix server (after completing the other steps described in the link above).
Currently, I am struggling with manually (and also via Zabbix items) calling
This returns something like
Following questions:
1. is there a better suited template available? would it be any easier to use isc-kea?
2. was it a good idea to migrate to Python3? (it seemed reasonable initially, but I have no educated guess how much effort is still required...)
3. how can I further investigate the root cause? (I did some trial-and-error converting some string arguments with .encode("utf-8") since it worked so well with KEYNAME - but no luck so far)
What I find interesting is that when calling
The result is "'0" with no errors.
But as soon as the last value reaches the first value (e.g. 192.168.1.100-192.168.1.100), the above error is raised.
I would like to monitor the number of leases of my dhcp server (Ubuntu 20.04, isc-dhcp-server).
I tried to follow these:
- https://share.zabbix.com/cat-app/app-other/isc-dhcpd
- https://github.com/garbled1/zabbix_isc_dhcpd
I am not strong with Python, but so far, I figured out a few things:
- on dhcp-server: installed python3, pip3 and both pip-installs (pypureomapi and netaddr)
- had to migrate a few things to be conformant with Python3 (print "test" => print("test") and KEYNAME = 'omapi_key'.encode("utf-8")
When calling ./check_dhcp_leases.py, the parsed info from dhcpd.conf is returned. This also works from Zabbix server (after completing the other steps described in the link above).
Currently, I am struggling with manually (and also via Zabbix items) calling
Code:
./check_dhcp_leases.ph 192.168.1.100-192.168.1.120 Total
Code:
File "./check_dhsp_leases.py", line xx, in <module>
sys.exit(checkRange(sys.argv[1], sys.argv[2]))
File "./check_dhsp_leases.py", line xx, in checkRange
response = o.query_server(msg)
...
File "/home/user/.local/lib/python3.8/site-packages/pypureomapi.py", line 145, in add
self.buff.write(data)
TypeError: a bytes-like object is required, not 'str'
1. is there a better suited template available? would it be any easier to use isc-kea?
2. was it a good idea to migrate to Python3? (it seemed reasonable initially, but I have no educated guess how much effort is still required...)
3. how can I further investigate the root cause? (I did some trial-and-error converting some string arguments with .encode("utf-8") since it worked so well with KEYNAME - but no luck so far)
What I find interesting is that when calling
Code:
./check_dhcp_leases.ph 192.168.1.100-192.168.1.99 Total
But as soon as the last value reaches the first value (e.g. 192.168.1.100-192.168.1.100), the above error is raised.