mirror of
https://github.com/lucaspalomodevelop/opnsense-core.git
synced 2026-03-13 00:07:27 +00:00
Reporting / Insight - move single_pass to command line parameters for easier debugging
This commit is contained in:
parent
8db4e28614
commit
d73ec9feae
@ -127,10 +127,12 @@ class Main(object):
|
||||
def set_config(cls, config):
|
||||
cls.config = config
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, single_pass=False):
|
||||
""" construct, hook signal handler and run aggregators
|
||||
:param single_pass: exit after one pass
|
||||
:return: None
|
||||
"""
|
||||
self.single_pass = single_pass
|
||||
self.running = True
|
||||
signal.signal(signal.SIGTERM, self.signal_handler)
|
||||
self.run()
|
||||
@ -168,7 +170,7 @@ class Main(object):
|
||||
check_rotate(self.config.flowd_source)
|
||||
|
||||
# wait for next pass, exit on sigterm
|
||||
if Main.config.single_pass:
|
||||
if self.single_pass:
|
||||
break
|
||||
else:
|
||||
# calculate time to wait in between parses. since tailing flowd.log is quite time consuming
|
||||
@ -195,6 +197,7 @@ if __name__ == '__main__':
|
||||
parser.add_argument('--console', dest='console', help='run in console', action='store_true')
|
||||
parser.add_argument('--profile', dest='profile', help='enable profiler', action='store_true')
|
||||
parser.add_argument('--repair', dest='repair', help='init repair', action='store_true')
|
||||
parser.add_argument('--single_pass', dest='single_pass', help='exit after first pass', action='store_true')
|
||||
cmd_args = parser.parse_args()
|
||||
|
||||
Main.set_config(load_config())
|
||||
@ -210,7 +213,7 @@ if __name__ == '__main__':
|
||||
|
||||
pr = cProfile.Profile(builtins=False)
|
||||
pr.enable()
|
||||
Main()
|
||||
Main(True)
|
||||
pr.disable()
|
||||
s = io.StringIO()
|
||||
sortby = 'cumulative'
|
||||
@ -218,7 +221,7 @@ if __name__ == '__main__':
|
||||
ps.print_stats()
|
||||
print (s.getvalue())
|
||||
else:
|
||||
Main()
|
||||
Main(cmd_args.single_pass)
|
||||
elif cmd_args.repair:
|
||||
# force a database repair, when
|
||||
try:
|
||||
|
||||
@ -44,7 +44,6 @@ class Config(object):
|
||||
pid_filename = '/var/run/flowd_aggregate.pid'
|
||||
flowd_source = '/var/log/flowd.log'
|
||||
database_dir = '/var/netflow'
|
||||
single_pass = False
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
for key in kwargs:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user