This commit is contained in:
Clint Armstrong
2015-08-25 11:35:17 -04:00
parent b0c02a167e
commit 67b8f9f473
+4 -8
View File
@@ -1,8 +1,8 @@
#! /usr/bin/env python
"""
poller-service A service to wrap SNMP polling. It will poll up to $threads devices at a time, and will not re-poll
devices that have been polled within the last $poll_frequency seconds. It will prioritize devices based on
the last time polled. If resources are sufficient, this service should poll every device every
devices that have been polled within the last $poll_frequency seconds. It will prioritize devices based
on the last time polled. If resources are sufficient, this service should poll every device every
$poll_frequency seconds, but should gracefully degrade if resources are inefficient, polling devices as
frequently as possible. This service is based on poller-wrapper.py.
@@ -14,7 +14,6 @@
import json
import os
import Queue
import subprocess
import sys
import threading
@@ -37,6 +36,7 @@ config_file = install_dir + '/config.php'
log.info('INFO: Starting poller-service')
def get_config_data():
config_cmd = ['/usr/bin/env', 'php', '%s/config_to_json.php' % install_dir]
try:
@@ -169,6 +169,7 @@ def releaseLock(lock):
cursor.execute(query)
return cursor.fetchall()[0][0] == 1
def sleep_until(timestamp):
now = datetime.now()
if timestamp > now:
@@ -271,8 +272,3 @@ while True:
# If we made it this far, break out of the loop and query again.
break
try:
print_queue.join()
except (KeyboardInterrupt, SystemExit):
raise