diff options
author | root <root@krebs> | 2011-05-09 20:58:09 +0200 |
---|---|---|
committer | root <root@krebs> | 2011-05-09 20:58:09 +0200 |
commit | 483a46be9a90ef46b3f478d62f108d675159cdc6 (patch) | |
tree | a3a51b5a5bbd732e1972bd8b03f5bd9471571edd /modules/people/src/main.py | |
parent | 56cbb651fa8d5fd6c467b37da4faf745e625ce6c (diff) |
changed repos directory to fit krebs
Diffstat (limited to 'modules/people/src/main.py')
-rwxr-xr-x | modules/people/src/main.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/people/src/main.py b/modules/people/src/main.py new file mode 100755 index 00000000..c70bffd4 --- /dev/null +++ b/modules/people/src/main.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python2 +import sys,json,time +from snmp_users import snmp_users +import logging +import genericore as gen +MODULE_NAME='snmp_users' +log = logging.getLogger(MODULE_NAME) +PROTO_VERSION = 1 +DESCRIPTION = 'performes statistical analysis against mails from stream' + + +# set up instances of needed modules +conf = gen.Configurator(PROTO_VERSION,DESCRIPTION) +amqp = gen.auto_amqp(MODULE_NAME) +s = snmp_users(MODULE_NAME) # the magic mail parsing class + +conf.configure([amqp,s]) #set up parser and eval parsed stuff + +# start network connections +amqp.create_connection() + +log.info('Starting up snmp_users') +print ' Sending Messages in Intervals. To exit press CTRL+C' +try: + while True: + log.info("collecting data from network") + ret = s.collect() + data = { 'type' : 'snmp', 'subtype' : 0, 'data' : ret} + log.debug("writing data to queue : %s" % data) + amqp.publish(json.dumps(data)) + time.sleep(s.repeat) +except Exception as e: + print "something happened :( " + str(e) |