Improve Telegraf JSON parsing template for dhcpd leases #172
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before:
With the current format it's impossible to create any useful Grafana graphs except for the total summary across all DHCP networks, even though the statistics per domain would be more interesting in many cases.
Each DHCP network is just referenced by an array index number, which makes it hard to find the data for a specific domain.
The measurement name is a nondescript
exec_exec
.> exec_exec,host=gw04.in.ffmuc.net shared-networks_0_defined=2037,shared-networks_0_free=1994,shared-networks_0_touched=1923,shared-networks_0_used=43,shared-networks_10_defined=2037,shared-networks_10_free=2023,shared-networks_10_touched=1921,shared-networks_10_used=14,shared-networks_11_defined=2037,shared-networks_11_free=1981,shared-networks_11_touched=1885,shared-networks_11_used=56,shared-networks_12_defined=2037,shared-networks_12_free=2006,shared-networks_12_touched=1927,shared-networks_12_used=31,shared-networks_13_defined=2037,shared-networks_13_free=1984,shared-networks_13_touched=1947,shared-networks_13_used=53,shared-networks_14_defined=2037,shared-networks_14_free=2012,shared-networks_14_touched=1874,shared-networks_14_used=25,shared-networks_15_defined=2037,shared-networks_15_free=1927,shared-networks_15_touched=1603,shared-networks_15_used=110,shared-networks_16_defined=2037,shared-networks_16_free=1928,shared-networks_16_touched=1725,shared-networks_16_used=109,shared-networks_17_defined=2037,shared-networks_17_free=1998,shared-networks_17_touched=1821,shared-networks_17_used=39,shared-networks_18_defined=2037,shared-networks_18_free=1955,shared-networks_18_touched=1694,shared-networks_18_used=82,shared-networks_1_defined=2037,shared-networks_1_free=2033,shared-networks_1_touched=1349,shared-networks_1_used=4,shared-networks_2_defined=2037,shared-networks_2_free=2037,shared-networks_2_touched=2037,shared-networks_2_used=0,shared-networks_3_defined=2037,shared-networks_3_free=2018,shared-networks_3_touched=1998,shared-networks_3_used=19,shared-networks_4_defined=2037,shared-networks_4_free=2024,shared-networks_4_touched=1673,shared-networks_4_used=13,shared-networks_5_defined=2037,shared-networks_5_free=1999,shared-networks_5_touched=1953,shared-networks_5_used=38,shared-networks_6_defined=2037,shared-networks_6_free=1970,shared-networks_6_touched=1901,shared-networks_6_used=67,shared-networks_7_defined=2037,shared-networks_7_free=2012,shared-networks_7_touched=1925,shared-networks_7_used=25,shared-networks_8_defined=2037,shared-networks_8_free=2021,shared-networks_8_touched=1944,shared-networks_8_used=16,shared-networks_9_defined=2037,shared-networks_9_free=2000,shared-networks_9_touched=1948,shared-networks_9_used=37,subnets_0_defined=2037,subnets_0_free=1970,subnets_0_touched=1901,subnets_0_used=67,subnets_10_defined=2037,subnets_10_free=2024,subnets_10_touched=1673,subnets_10_used=13,subnets_11_defined=2037,subnets_11_free=2018,subnets_11_touched=1998,subnets_11_used=19,subnets_12_defined=2037,subnets_12_free=1994,subnets_12_touched=1923,subnets_12_used=43,subnets_13_defined=2037,subnets_13_free=2033,subnets_13_touched=1349,subnets_13_used=4,subnets_14_defined=2037,subnets_14_free=2037,subnets_14_touched=2037,subnets_14_used=0,subnets_15_defined=2037,subnets_15_free=1984,subnets_15_touched=1947,subnets_15_used=53,subnets_16_defined=2037,subnets_16_free=1999,subnets_16_touched=1953,subnets_16_used=38,subnets_17_defined=2037,subnets_17_free=1981,subnets_17_touched=1885,subnets_17_used=56,subnets_18_defined=2037,subnets_18_free=2006,subnets_18_touched=1927,subnets_18_used=31,subnets_1_defined=2037,subnets_1_free=2012,subnets_1_touched=1925,subnets_1_used=25,subnets_2_defined=2037,subnets_2_free=2021,subnets_2_touched=1944,subnets_2_used=16,subnets_3_defined=2037,subnets_3_free=2000,subnets_3_touched=1948,subnets_3_used=37,subnets_4_defined=2037,subnets_4_free=2023,subnets_4_touched=1921,subnets_4_used=14,subnets_5_defined=2037,subnets_5_free=2012,subnets_5_touched=1874,subnets_5_used=25,subnets_6_defined=2037,subnets_6_free=1927,subnets_6_touched=1603,subnets_6_used=110,subnets_7_defined=2037,subnets_7_free=1928,subnets_7_touched=1725,subnets_7_used=109,subnets_8_defined=2037,subnets_8_free=1998,subnets_8_touched=1821,subnets_8_used=39,subnets_9_defined=2037,subnets_9_free=1955,subnets_9_touched=1694,subnets_9_used=82,summary_defined=38703,summary_free=37922,summary_touched=35048,summary_used=781 1726689252000000000
After:
Now we have three separate measurements. The first two each with one series per domain, using the
location
tag (andsubnet
fordhcpd_pools_subnets
, as we could potentially add multiple DHCP ranges per network/location).The third measurement is the total summary.
We have to run the
dhcpd-pools
command three times now, neither thejson
nor thejson_v2
parser plugins were able to create multiple measurements from one input run.This way we can properly monitor each segment separately and show them in the dashboards.