|
67 | 67 | (options, args) = parser.parse_args() |
68 | 68 |
|
69 | 69 | # Get terminal width for usage with pprint |
70 | | -rows,columns = os.popen("stty size", "r").read().split() |
| 70 | +rows, columns = os.popen("stty size", "r").read().split() |
71 | 71 |
|
72 | 72 | # First, create an instance of the netsnmpAgent class. We specify the |
73 | 73 | # fully-qualified path to SIMPLE-MIB.txt ourselves here, so that you |
|
86 | 86 |
|
87 | 87 | # Then we create all SNMP scalar variables we're willing to serve. |
88 | 88 | simpleInteger = agent.Integer32( |
89 | | - oidstr = "SIMPLE-MIB::simpleInteger" |
| 89 | + oidstr = "SIMPLE-MIB::simpleInteger" |
90 | 90 | ) |
91 | 91 | simpleIntegerContext1 = agent.Integer32( |
92 | | - oidstr = "SIMPLE-MIB::simpleInteger", |
93 | | - context = "context1", |
94 | | - initval = 200, |
| 92 | + oidstr = "SIMPLE-MIB::simpleInteger", |
| 93 | + context = "context1", |
| 94 | + initval = 200, |
95 | 95 | ) |
96 | 96 | simpleIntegerRO = agent.Integer32( |
97 | 97 | oidstr = "SIMPLE-MIB::simpleIntegerRO", |
98 | 98 | writable = False |
99 | 99 | ) |
100 | 100 | simpleUnsigned = agent.Unsigned32( |
101 | | - oidstr = "SIMPLE-MIB::simpleUnsigned" |
| 101 | + oidstr = "SIMPLE-MIB::simpleUnsigned" |
102 | 102 | ) |
103 | 103 | simpleUnsignedRO = agent.Unsigned32( |
104 | 104 | oidstr = "SIMPLE-MIB::simpleUnsignedRO", |
105 | 105 | writable = False |
106 | 106 | ) |
107 | 107 | simpleCounter32 = agent.Counter32( |
108 | | - oidstr = "SIMPLE-MIB::simpleCounter32" |
| 108 | + oidstr = "SIMPLE-MIB::simpleCounter32" |
109 | 109 | ) |
110 | 110 | simpleCounter32Context2 = agent.Counter32( |
111 | | - oidstr = "SIMPLE-MIB::simpleCounter32", |
112 | | - context = "context2", |
113 | | - initval = pow(2,32) - 10, # To rule out endianness bugs |
| 111 | + oidstr = "SIMPLE-MIB::simpleCounter32", |
| 112 | + context = "context2", |
| 113 | + initval = pow(2,32) - 10, # To rule out endianness bugs |
114 | 114 | ) |
115 | 115 | simpleCounter64 = agent.Counter64( |
116 | | - oidstr = "SIMPLE-MIB::simpleCounter64" |
| 116 | + oidstr = "SIMPLE-MIB::simpleCounter64" |
117 | 117 | ) |
118 | 118 | simpleCounter64Context2 = agent.Counter64( |
119 | | - oidstr = "SIMPLE-MIB::simpleCounter64", |
120 | | - context = "context2", |
121 | | - initval = pow(2,64) - 10, # To rule out endianness bugs |
| 119 | + oidstr = "SIMPLE-MIB::simpleCounter64", |
| 120 | + context = "context2", |
| 121 | + initval = pow(2,64) - 10, # To rule out endianness bugs |
122 | 122 | ) |
123 | 123 | simpleTimeTicks = agent.TimeTicks( |
124 | | - oidstr = "SIMPLE-MIB::simpleTimeTicks" |
| 124 | + oidstr = "SIMPLE-MIB::simpleTimeTicks" |
125 | 125 | ) |
126 | 126 | simpleIpAddress = agent.IpAddress( |
127 | | - oidstr = "SIMPLE-MIB::simpleIpAddress", |
128 | | - initval="127.0.0.1" |
| 127 | + oidstr = "SIMPLE-MIB::simpleIpAddress", |
| 128 | + initval = "127.0.0.1" |
129 | 129 | ) |
130 | 130 | simpleOctetString = agent.OctetString( |
131 | | - oidstr = "SIMPLE-MIB::simpleOctetString", |
132 | | - initval = "Hello World" |
| 131 | + oidstr = "SIMPLE-MIB::simpleOctetString", |
| 132 | + initval = "Hello World" |
133 | 133 | ) |
134 | 134 | simpleDisplayString = agent.DisplayString( |
135 | | - oidstr = "SIMPLE-MIB::simpleDisplayString", |
136 | | - initval = "Nice to meet you" |
| 135 | + oidstr = "SIMPLE-MIB::simpleDisplayString", |
| 136 | + initval = "Nice to meet you" |
137 | 137 | ) |
138 | 138 |
|
139 | 139 | # Create the first table |
140 | 140 | firstTable = agent.Table( |
141 | | - oidstr = "SIMPLE-MIB::firstTable", |
| 141 | + oidstr = "SIMPLE-MIB::firstTable", |
142 | 142 | indexes = [ |
143 | 143 | agent.DisplayString() |
144 | 144 | ], |
|
167 | 167 |
|
168 | 168 | # Create the second table |
169 | 169 | secondTable = agent.Table( |
170 | | - oidstr = "SIMPLE-MIB::secondTable", |
| 170 | + oidstr = "SIMPLE-MIB::secondTable", |
171 | 171 | indexes = [ |
172 | 172 | agent.Integer32() |
173 | 173 | ], |
|
192 | 192 |
|
193 | 193 | # Create the third table |
194 | 194 | thirdTable = agent.Table( |
195 | | - oidstr = "SIMPLE-MIB::thirdTable", |
196 | | - indexes = [ |
| 195 | + oidstr = "SIMPLE-MIB::thirdTable", |
| 196 | + indexes = [ |
197 | 197 | agent.IpAddress() |
198 | 198 | ], |
199 | | - columns = [ |
| 199 | + columns = [ |
200 | 200 | (2, agent.DisplayString("Broadcast")), |
201 | 201 | (3, agent.IpAddress("192.168.0.255")) |
202 | 202 | ], |
|
0 commit comments