Skip to content

Commit 3f2e4fb

Browse files
committed
Rename "location"-flag to "namespace", update docs
1 parent 97d1b7b commit 3f2e4fb

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

contrib/scripts/isc_dhpcd_graphite/README.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ Building the prefix
1515
===================
1616

1717
The dotted-path that graphite uses to store data is controlled by the prefix
18-
argument to the script (-p), the optional location argument (-l) and what
19-
``dhcpd_pool`` returns as its ``location`` key.
18+
argument to the script (-p), the optional namespace argument (-N) and what
19+
``dhcpd_pool`` returns as its ``location`` per entry of the ``shared_networks``
20+
list. (What ``dhcpd_pool`` calls "location" is elsewhere known as "DHCP network
21+
name".)
2022

2123
The default prefix is "nav.dhcp".
2224

23-
If ``-p`` is "nav.bloviate", ``-l`` is not set and the ``location`` in the json
25+
If ``-p`` is "nav.bloviate", ``-N`` is not set and the ``location`` in the json
2426
is "vlan1" the resulting graphite path is ``nav.bloviate.vlan1``.
2527

2628

contrib/scripts/isc_dhpcd_graphite/isc_dhpcd_graphite.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,16 @@ def escape_metric_name(name):
5656

5757
# parse comand line flags
5858
def parse_args():
59-
parser = argparse.ArgumentParser(description="Send dhcp stats to graphite")
59+
description = '''\
60+
Send dhcp stats to graphite
61+
62+
The metric-name is taken from the location-field in the shared_networks
63+
part of the output.
64+
'''
65+
parser = argparse.ArgumentParser(
66+
formatter_class=argparse.RawDescriptionHelpFormatter,
67+
description=description,
68+
)
6069
parser.add_argument(
6170
"server",
6271
help="Graphite server to send data to",
@@ -89,20 +98,20 @@ def parse_args():
8998
default=DEFAULT_PREFIX,
9099
)
91100
parser.add_argument(
92-
"-l",
93-
"--location",
101+
"-N",
102+
"--namespace",
94103
help=(
95-
"Location, if any, to append to the metric prefix to build the path."
96-
' If the location is named "vlan1" and the location is "building1.cellar"'
97-
" the resulting metric path would be PREFIX.building1.cellar.vlan1"
104+
"Namespace, if any, to append to the metric prefix to build the path."
105+
' If the location is "vlan1" and the namespace is "building1.cellar"'
106+
' the resulting metric path would be "PREFIX.building1.cellar.vlan1"'
98107
),
99108
type=str,
100109
)
101110
parser.add_argument(
102111
"--extract-vlan",
103112
help=(
104113
"Try to extract the name of a vlan from the location."
105-
' If the vlan is named "vlan1_baluba" '
114+
' If the location is "vlan1_baluba" '
106115
" the resulting metric path would be PREFIX.vlan1"
107116
),
108117
action="store_true",

0 commit comments

Comments
 (0)