Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Update usage in README, remove unnecessary parenthesis and make sure …
Browse files Browse the repository at this point in the history
…-L is used only with -p
  • Loading branch information
Stefan Safar committed Sep 3, 2020
1 parent 89d3496 commit 427f7d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ Warning: since 0.3.0, the code relies on Python3 specific code. If you need to u
the 0.2.6 version.
# Usage
```
usage: ethtool-exporter.py [-h] (-f TEXTFILE_NAME | -l LISTEN) [-i INTERVAL]
[-I INTERFACE_REGEX] [-1]
usage: ethtool-exporter.py [-h] (-f TEXTFILE_NAME | -l LISTEN | -p PORT)
[-L LISTEN_ADDRESS] [-i INTERVAL]
[-I INTERFACE_REGEX] [-1] [-q]
[-w WHITELIST_REGEX | -b BLACKLIST_REGEX]
optional arguments:
Expand All @@ -24,14 +25,19 @@ optional arguments:
Full file path where to store data for node collector
to pick up
-l LISTEN, --listen LISTEN
Listen host:port, i.e. 0.0.0.0:9417
OBSOLETE. Use -L/-p instead. Listen host:port, i.e.
0.0.0.0:9417
-p PORT, --port PORT Port to listen on, i.e. 9417
-L LISTEN_ADDRESS, --listen-address LISTEN_ADDRESS
IP address to listen on
-i INTERVAL, --interval INTERVAL
Number of seconds between updates of the textfile.
Default is 5 seconds
-I INTERFACE_REGEX, --interface-regex INTERFACE_REGEX
Only scrape interfaces whose name matches this regex
-1, --oneshot Run only once and exit. Useful for running in a
cronjob
-q, --quiet Silence any error messages and warnings
-w WHITELIST_REGEX, --whitelist-regex WHITELIST_REGEX
Only include values whose name matches this regex. -w
and -b are mutually exclusive
Expand Down
10 changes: 7 additions & 3 deletions ethtool-exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def _parse_args(self, args):
logging.error('Interval has to be used with textfile mode')
parser.print_help()
sys.exit(1)
if arguments.listen_address and not arguments.port:
logging.error('Listen address has to be used with a listen port')
parser.print_help()
sys.exit(1)
if not arguments.interval:
arguments.interval = 5
self.args = vars(arguments)
Expand Down Expand Up @@ -222,9 +226,9 @@ class IPv6HTTPServer(HTTPServer):
args = collector.args
if args['listen'] or args['port']:
if args['listen']:
logging.warning(('You are using obsolete argument -l.'
'Please switch to -L and -p'))
(ip, port) = args['listen'].rsplit(':', 1)
logging.warning('You are using obsolete argument -l.'
'Please switch to -L and -p')
ip, port = args['listen'].rsplit(':', 1)
else:
ip = args['listen_address']
port = args['port']
Expand Down

0 comments on commit 427f7d6

Please sign in to comment.