mirror of
https://github.com/alerta/alerta.git
synced 2025-01-29 03:11:34 +00:00
36 lines
1.1 KiB
Python
Executable file
36 lines
1.1 KiB
Python
Executable file
#!/usr/bin/env python
|
|
########################################
|
|
#
|
|
# alert-snmptrap - Alert SNMP Trap handler
|
|
#
|
|
########################################
|
|
|
|
"""
|
|
Usage: /etc/snmp/snmptrapd.conf
|
|
|
|
authCommunity log,execute,net public
|
|
format execute $a %a\n$A %A\n$s %s\n$b %b\n$B %B\n$x %#y-%#02m-%#02l\n$X %#02.2h:%#02.2j:%#02.2k\n$N %N\n$q %q\n$P %P\n$t %t\n$T %T\n$w %w\n$W %W\n%V~\%~%v\n
|
|
traphandle default alert-snmptrap --debug
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|
os.pardir,
|
|
os.pardir))
|
|
if os.path.exists(os.path.join(possible_topdir, 'alerta', '__init__.py')):
|
|
sys.path.insert(0, possible_topdir)
|
|
|
|
from alerta.common import config
|
|
from alerta.common import log as logging
|
|
from alerta.snmptrap.handler import SnmpTrapHandler, Version
|
|
|
|
LOG = logging.getLogger('alerta.snmptrap')
|
|
CONF = config.CONF
|
|
|
|
if __name__ == '__main__':
|
|
config.parse_args(version=Version)
|
|
logging.setup('alerta')
|
|
handler = SnmpTrapHandler('alert-snmptrap')
|
|
handler.start()
|