mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Add help and parameters
This commit is contained in:
parent
fedc7143b3
commit
4365a170a3
2 changed files with 46 additions and 2 deletions
|
|
@ -19,7 +19,7 @@ from ntopng.ntopng import Ntopng
|
|||
|
||||
### NTOPNG API SETUP
|
||||
username = "admin"
|
||||
password = "admin1"
|
||||
password = "admin"
|
||||
ntopng_url = "http://localhost:3000"
|
||||
iface_id = 0
|
||||
auth_token = None
|
||||
|
|
@ -28,6 +28,50 @@ enable_debug = False
|
|||
actual_ts = int(time.time())
|
||||
yesterday = (actual_ts - 86400)
|
||||
|
||||
##########
|
||||
|
||||
def usage():
|
||||
print("interface.py [-u <username>] [-p <password>] [-t <auth token>] [-n <ntopng_url>]")
|
||||
print(" [-i <interface ID>] [--debug] [--help]")
|
||||
print("")
|
||||
print("Example: ./interface.py -t ce0e284c774fac5a3e981152d325cfae -i 4")
|
||||
print(" ./interface.py -u ntop -p mypassword -i 4")
|
||||
sys.exit(0)
|
||||
|
||||
##########
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:],
|
||||
"hdu:p:n:i:t:",
|
||||
["help",
|
||||
"debug",
|
||||
"username=",
|
||||
"password=",
|
||||
"ntopng_url=",
|
||||
"iface_id=",
|
||||
"auth_token="]
|
||||
)
|
||||
except getopt.GetoptError as err:
|
||||
print(err)
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
for o, v in opts:
|
||||
if(o in ("-h", "--help")):
|
||||
usage()
|
||||
elif(o in ("-d", "--debug")):
|
||||
enable_debug = True
|
||||
elif(o in ("-u", "--username")):
|
||||
username = v
|
||||
elif(o in ("-p", "--password")):
|
||||
password = v
|
||||
elif(o in ("-n", "--ntopng_url")):
|
||||
ntopng_url = v
|
||||
elif(o in ("-i", "--iface_id")):
|
||||
iface_id = v
|
||||
elif(o in ("-t", "--auth_token")):
|
||||
auth_token = v
|
||||
|
||||
##################################
|
||||
######### DATA COLLECTOR #########
|
||||
##################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue