mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Revert "Ability to enable debug output with wrappers" (#8829)
Reverts librenms/librenms#8811
This commit is contained in:
@@ -40,7 +40,6 @@ try:
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import argparse
|
||||
|
||||
except:
|
||||
print "ERROR: missing one or more of the following python modules:"
|
||||
@@ -86,7 +85,6 @@ except:
|
||||
sys.exit(2)
|
||||
|
||||
discovery_path = config['install_dir'] + '/discovery.php'
|
||||
log_dir = config['log_dir']
|
||||
db_username = config['db_user']
|
||||
db_password = config['db_pass']
|
||||
db_port = int(config['db_port'])
|
||||
@@ -190,16 +188,13 @@ discovered_devices = 0
|
||||
Take the amount of threads we want to run in parallel from the commandline
|
||||
if None are given or the argument was garbage, fall back to default of 16
|
||||
"""
|
||||
parser = argparse.ArgumentParser(description='Spawn multiple discovery.php processes in parallel.',
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument('-d', '--debug', action='store_true', default=False,
|
||||
help="Enable debug output. WARNING: Leaving this enabled will consume a lot of disk space.")
|
||||
parser.add_argument('workers', metavar='N', type=int, default=1, nargs='?',
|
||||
help='The max number of workers allowed to run at one time. If too high this can overwelm your server.')
|
||||
args = parser.parse_args()
|
||||
|
||||
amount_of_workers = args.workers
|
||||
debug = args.debug
|
||||
try:
|
||||
amount_of_workers = int(sys.argv[1])
|
||||
if amount_of_workers == 0:
|
||||
print "ERROR: 0 threads is not a valid value"
|
||||
sys.exit(2)
|
||||
except:
|
||||
amount_of_workers = 1
|
||||
|
||||
devices_list = []
|
||||
|
||||
@@ -309,11 +304,8 @@ def poll_worker():
|
||||
# EOC5
|
||||
try:
|
||||
start_time = time.time()
|
||||
|
||||
output = "-d >> %s/discover_device_%s.log" % (log_dir, device_id) if debug else ">> /dev/null"
|
||||
command = "/usr/bin/env php %s -h %s %s 2>&1" % (discovery_path, device_id, output)
|
||||
command = "/usr/bin/env php %s -h %s >> /dev/null 2>&1" % (discovery_path, device_id)
|
||||
subprocess.check_call(command, shell=True)
|
||||
|
||||
elapsed_time = int(time.time() - start_time)
|
||||
print_queue.put([threading.current_thread().name, device_id, elapsed_time])
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
|
Reference in New Issue
Block a user