Skip to content

Instantly share code, notes, and snippets.

@jgram925
Last active March 22, 2021 20:40
Show Gist options
  • Save jgram925/676496d94839a3ddb4606a3047243a2e to your computer and use it in GitHub Desktop.
Save jgram925/676496d94839a3ddb4606a3047243a2e to your computer and use it in GitHub Desktop.
SNMP with Python.md

How to monitor Linux servers with SNMP & OIDs

Enable remote SNMP on agents

SNMP on S.M.A.R.T. drives

Checking S.M.A.R.T. management tools are working properly

Synology MIB Docs

Commonly Used APC OIDs

Common OIDs

nas raid status: .1.3.6.1.4.1.6574.3.1.1.3.0

nas available disk: .1.3.6.1.4.1.6574.3.1.1.5.0

nas & hyperV smart check: .1.3.6.1.4.1.6574.5.1.1.9

ups status: .1.3.6.1.4.1.318.1.1.1.4.1.1.0

linux memory free: .1.3.6.1.4.1.2021.4.11.0

linux available disk space: .1.3.6.1.4.1.2021.9.1.7.1

linux cpu load over 1 minute: .1.3.6.1.4.1.2021.10.1.3.1

Example using SubProcess

import subprocess

community = 'public'
location = '10.6.0.12'
check_oid = '.1.3.6.1.4.1.318.1.1.1.2.1.1.0'

results = subprocess.check_output(["snmpwalk", "-Oqv", "-v2c", "-c", community, location, check_oid])
decoded_results = str(results.decode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment