File: ntforg.py

package info (click to toggle)
python-pysnmp4 4.1.6a-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,016 kB
  • ctags: 1,826
  • sloc: python: 9,809; sh: 60; makefile: 11
file content (20 lines) | stat: -rw-r--r-- 619 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Notification Originator (TRAP/INFORM)
from pysnmp.entity.rfc3413.oneliner import ntforg
from pysnmp.proto.api import v2c

errorIndication = ntforg.NotificationOriginator().sendNotification(
    # SNMP v1
#    ntforg.CommunityData('test-manager', 'public', 0),
    # SNMP v2
#   ntforg.CommunityData('test-manager', 'public'),
    # SNMP v3
    ntforg.UsmUserData('test-user', 'authkey1', 'privkey1'),
    ntforg.UdpTransportTarget(('localhost', 162)),
#    'trap',
    'inform',    
    ('SNMPv2-MIB', 'coldStart'),
    ((1,3,6,1,2,1,1,3,0), v2c.TimeTicks(44100))
    )

if errorIndication:
    print errorIndication