mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-02 00:32:09 +02:00
discover integration working
This commit is contained in:
+6
-6
@@ -105,11 +105,11 @@ except KeyError:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
discover_frequency = int(config['poller_service_discover_frequency'])
|
discover_frequency = int(config['poller_service_discover_frequency'])
|
||||||
if poll_frequency == 0:
|
if discover_frequency == 0:
|
||||||
log.critical("ERROR: 0 seconds is not a valid value")
|
log.critical("ERROR: 0 seconds is not a valid value")
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
poll_frequency = 21600
|
discover_frequency = 21600
|
||||||
|
|
||||||
try:
|
try:
|
||||||
down_retry = int(config['poller_service_down_retry'])
|
down_retry = int(config['poller_service_down_retry'])
|
||||||
@@ -135,8 +135,8 @@ def poll_worker(device_id, action):
|
|||||||
try:
|
try:
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
path = poller_path
|
path = poller_path
|
||||||
if action = 'discovery'
|
if action == 'discovery':
|
||||||
path = discovery_path
|
path = discover_path
|
||||||
command = "/usr/bin/env php %s -h %s >> /dev/null 2>&1" % (path, device_id)
|
command = "/usr/bin/env php %s -h %s >> /dev/null 2>&1" % (path, device_id)
|
||||||
subprocess.check_call(command, shell=True)
|
subprocess.check_call(command, shell=True)
|
||||||
elapsed_time = int(time.time() - start_time)
|
elapsed_time = int(time.time() - start_time)
|
||||||
@@ -189,7 +189,7 @@ dev_query = ( 'SELECT device_id, '
|
|||||||
' last_polled, '
|
' last_polled, '
|
||||||
' INTERVAL last_polled_timetaken SECOND '
|
' INTERVAL last_polled_timetaken SECOND '
|
||||||
' ), '
|
' ), '
|
||||||
' INTERVAL {0} SECOND) AS next_poll '
|
' INTERVAL {0} SECOND) AS next_poll, '
|
||||||
'DATE_ADD( '
|
'DATE_ADD( '
|
||||||
' DATE_SUB( '
|
' DATE_SUB( '
|
||||||
' last_discovered, '
|
' last_discovered, '
|
||||||
@@ -242,7 +242,7 @@ while True:
|
|||||||
releaseLock('queued.{}'.format(device_id))
|
releaseLock('queued.{}'.format(device_id))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if next_poll > datetime.now():
|
if next_poll and next_poll > datetime.now():
|
||||||
poll_action = 'polling'
|
poll_action = 'polling'
|
||||||
sleep_until_time = next_poll
|
sleep_until_time = next_poll
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user