Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| myapps:snmp-voice-stats [2021/01/12 15:39] – [Python script] gerardorourke | myapps:snmp-voice-stats [2025/03/12 11:00] (current) – gerardorourke | ||
|---|---|---|---|
| Line 15: | Line 15: | ||
| <file python get-snmp-stats.py> | <file python get-snmp-stats.py> | ||
| # Author: Gerry O' | # Author: Gerry O' | ||
| - | # Jan 2021 | + | # Version 1.1 - Jan 2021 |
| - | # Version 1.1 | + | # Version 1.2 - Mar 2025 - updated Fetch Function to handle tuple rather than iterator (due to changes in get getCmd) |
| from pysnmp import hlapi | from pysnmp import hlapi | ||
| Line 73: | Line 73: | ||
| for i in range(count): | for i in range(count): | ||
| try: | try: | ||
| - | error_indication, | + | |
| + | | ||
| if not error_indication and not error_status: | if not error_indication and not error_status: | ||
| items = {} | items = {} | ||
| Line 81: | Line 83: | ||
| else: | else: | ||
| raise RuntimeError(' | raise RuntimeError(' | ||
| - | except | + | except |
| - | | + | |
| - | return result | + | return result |
| Line 104: | Line 106: | ||
| ' | ' | ||
| ' | ' | ||
| - | + | ||
| + | #if using SQL auth instead of windows user (remove Trusted_Connection) | ||
| + | #' | ||
| + | #' | ||
| + | |||
| cursor = conn.cursor() | cursor = conn.cursor() | ||
| rows = cursor.execute(' | rows = cursor.execute(' | ||