{"id":20975359,"url":"https://github.com/roe-dl/weewx-snmp","last_synced_at":"2026-04-15T06:41:36.146Z","repository":{"id":63152370,"uuid":"565564279","full_name":"roe-dl/weewx-snmp","owner":"roe-dl","description":"WeeWX service to fetch data by SNMP","archived":false,"fork":false,"pushed_at":"2024-07-15T05:22:35.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T05:43:42.685Z","etag":null,"topics":["monitoring","pysnmp","snmp","sql","weewx","weewx-service"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roe-dl.png","metadata":{"files":{"readme":"README.md","changelog":"changelog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-13T19:53:53.000Z","updated_at":"2024-07-15T05:22:38.000Z","dependencies_parsed_at":"2024-11-19T05:01:07.782Z","dependency_job_id":null,"html_url":"https://github.com/roe-dl/weewx-snmp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roe-dl%2Fweewx-snmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roe-dl%2Fweewx-snmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roe-dl%2Fweewx-snmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roe-dl%2Fweewx-snmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roe-dl","download_url":"https://codeload.github.com/roe-dl/weewx-snmp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243374326,"owners_count":20280661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["monitoring","pysnmp","snmp","sql","weewx","weewx-service"],"created_at":"2024-11-19T04:42:55.022Z","updated_at":"2025-12-29T06:28:33.748Z","avatar_url":"https://github.com/roe-dl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# weewx-snmp\nWeeWX service to fetch data by SNMP\n\nThere are sensors that offer their readings by SNMP. Fortunately there\nis a powerful Python module available to speak SNMP. This extension\nmakes it available to WeeWX.\n\n## Prerequisites\n\nInstall PySNMP if it is not already there.\n\n```\nsudo apt-get install python3-pysnmp\n```\n\nIn newer releases of Ubuntu you have to enter:\n\n```\nsudo apt-get install python3-pysnmp4\n```\n\n\n## Installation instructions\n\n1) download\n\n   ```\n   wget -O weewx-snmp.zip https://github.com/roe-dl/weewx-snmp/archive/master.zip\n   ```\n\n2) run the installer\n\n   WeeWX up to version 4.X\n\n   ```\n   sudo wee_extension --install weewx-snmp.zip\n   ```\n\n   WeeWX from version 5.0 on and WeeWX packet installation\n\n   ```\n   sudo weectl extension install weewx-snmp.zip\n   ```\n\n   WeeWX from version 5.0 on and WeeWX pip installation into an virtual environment\n\n   ```shell\n   source ~/weewx-venv/bin/activate\n   weectl extension install weewx-snmp.zip\n   ```\n   \n3) edit configuration in weewx.conf\n\n   Before using this extension you have to set up which devices\n   to be queried and which variables to be fetched. See\n   section \"Configuration\" for details.\n\n   **Caution!** If you want to save the readings to a separate \n   database and have it created properly, you have to edit\n   the configuration file before you **first** start WeeWX\n   after installing the extension. \n\n   If you want to add additional variables afterwards you have to \n   extend the database schema manually by using the\n   `wee_database` utility (`weectl database` in WeeWX 5).\n   This is **not** done automatically.\n\n5) restart weewx\n\n   for SysVinit systems:\n\n   ```\n   sudo /etc/init.d/weewx stop\n   sudo /etc/init.d/weewx start\n   ```\n\n   for systemd systems:\n\n   ```\n   sudo systemctl stop weewx\n   sudo systemctl start weewx\n   ```\n\n## Configuration\n\nThis extension can query several devices simultaneously. It creates a\nseparate thread for each of them. In section `[SNMP]` of `weewx.conf` \neach device has its own subsection. You can name that subsection as\nyou want. The name is used to name the thread, only. \n\nEach subsection contains of the following information:\n* connection data\n* authentication data\n* subsubsection(s) containing the description of the variables \n  (observation types) to fetch, their names in WeeWX,\n  unit and unit group, and - if necessary - some conversion\n  formula.\n\n### General options\n\n* `enable`: If True or omitted, retrieve data from that device.\n  If False, that subsection is not used. (optional)\n* `log_success`: If True, log successful operation. \n  If omitted, global options apply. (optional)\n* `log_failure`: If True, log unsuccessful operation. \n  If omitted, global options apply. (optional)\n* `data_binding`: data binding to use for storage \n  (or `None` if no extra data binding is to be used)\n* `include`: include configuration data from the file indicated by this\n  option into the `[SNMP]` section. Use absolute path. This is to\n  increase readability of the configuration only. It is up to you to\n  decide wether to put the configuration data directly into `weewx.conf` \n  or into the include file.\n\n### Connection configuration\n\n* `host`: host name or IP address of the device to get data from\n  (mandatory)\n* `port`: port number (mandatory, standard 161)\n* `timeout`: request timeout (optional, default is 0.5s)\n* `retries`: request retries (0 is no retries) (optional, default is\n   no retries)\n* `query_interval`: query interval (optional, default 5s)\n\n### Authentication configuration\n\nThere are different authentication methods for SNMP version 1 and 2c\non one hand and 3 on the other hand.\n\nconfiguration entries for SNMP version 1 and 2c:\n* `protocol_version`: Protocol version to use. Possible values are 1 or 2c\n* `community`: Community name for receiving data. Often it is `public`.\n\nconfiguration entries for SNMP version 3:\n* `protocol_version`: Protocol version to use. In this case 3.\n* `username`: User name\n* `password`: Password (optional)\n* `password_protocol`: Authentication protocol, see below\n  for possible values (optional)\n* `encryption`: Encryption passphrase (optional)\n* `encryption_protocol`: Privacy protocol (means: encryption protocol),\n  see below for possible values (optional)\n\nPossible values for `password_protocol`:\n* usmNoAuthProtocol\n* usmHMACMD5AuthProtocol\n* usmHMACSHAAuthProtocol\n* usmHMAC128SHA224AuthProtocol\n* usmHMAC192SHA256AuthProtocol\n* usmHMAC256SHA384AuthProtocol\n* usmHMAC384SHA512AuthProtocol\n\nPossible values for `encryption_protocol`:\n* usmNoPrivProtocol\n* usmDESPrivProtocol\n* usm3DESEDEPrivProtocol\n* usmAesCfb128Protocol\n* usmAesCfb192Protocol\n* usmAesCfb256Protocol\n* usmAesBlumenthalCfb192Protocol\n* usmAesBlumenthalCfb256Protocol\n\n### Variables configuration\n\nThere are two possible subsubsections, `[[[once]]]` and `[[[loop]]]`,\nthe former is used once at program start and logged to syslog, \nthe latter is performed continuously and included in the LOOP \npackets. If no `[[[once]]]` subsubsection is present, defaults\nare used, fetching some general device information. For the\n`[[[loop]]]` subsubsection, there are no defaults.\n\n* `oid`: OID of the variable. If omitted, the section name is used \n  for OID.\n* `conversion`: optional conversion formula\n* `name`: Observation type name used inside WeeWX\n* `unit`: The unit the reading is provided by the device.\n  That is **not** the unit the readings are to be saved to\n  database or displayed in skins. For those purposes the values are converted\n  automatically by WeeWX. The unit here is the source unit.\n* `group`: Unit group, used by WeeWX to choose the right unit\n  to save to database and to display in skins.\n  If omitted, the extension tries to determine the unit group\n  by the unit. \n* `sql_datatype`: If specified, this datatype is used when creating\n  the database table. Default is `REAL` if omitted. This entry can\n  be used for string data especially. An example for a string datatype\n  is `VARCHAR(30)`.\n\nSee [WeeWX Customization Guide](http://www.weewx.com/docs/customizing.htm#units)\nfor a list of predefined units and unit groups.\n\nThe observation types are automatically registered with WeeWX.\n\nThe standardized OID for sensor readings is `iso.3.6.1.2.1.99.1.1.1.4`,\nfollowed by an index of the sensor, starting with `.1`.\n\n### Accumulators\n\nAccumulators define how to aggregate the readings during the\narchive interval.\nThis extension tries to set up reasonable accumulators for the\nobservation types defined in the `[[[loop]]]` subsubsection. If\nthey do not work for you, you can set up accumulators manually\nin the `[Accumulator]` section of `weewx.conf`.\nSee [WeeWX Accumulators wiki page](https://github.com/weewx/weewx/wiki/Accumulators)\nfor how to set up accumulators in WeeWX.\n\nThe accumulator `firstlast` does not work for numeric values of this\nextension. The reason is that the database schema within this extension\nincludes all numeric values in the list of daily summeries tables. But\nWeeWX let you have an observation type either with a daily summeries\ntable or the `firstlast` accumulator, not both.\n\n### Example configuration\n\n```\n...\n\n[DataBindings]\n    ...\n    # additional section for an extra database to store the SNMP data\n    # optional!\n    [[snmp_binding]]\n        database = snmp_sqlite\n        table_name = archive\n        manager = weewx.manager.DaySummaryManager\n        schema = user.snmp.schema\n\n[Databases]\n    ...\n    # additional section for an extra database to store SNMP data\n    # optional!\n    [[snmp_sqlite]]\n        database_name = snmp.sdb\n        database_type = SQLite\n\n[Engine]\n    [[Services]]\n        data_services = ..., user.snmp.SNMPservice\n        archive_services = ..., user.snmp.SNMParchive\n\n...\n\n[SNMP]\n\n    # extra database\n    # optional!\n    # to switch off set data_binding = None\n    data_binding = snmp_binding\n\n    # Each subsection represents one device to be connected. There\n    # can be several such sections. The section name can be freely \n    # chosen. It is only used for the thread name. \n    [[UPS]]\n\n        # host and port to be connected\n        host = replace_me\n        port = 161\n        # optional\n        #query_interval = 5\n\n        # authentication data\n        protocol_version = 2c # possible values '1', '2c', '3'\n        # for version 1 and 2c\n        community = replace_me\n        # for version 3\n        #username = replace_me\n        #password = replace_me\n        #password_protocol = usmNoAuthProtocol\n\n        # data to fetch\n        [[[loop]]]\n            # UPS data\n            [[[[iso.3.6.1.2.1.33.1.3.3.1.2.1]]]]\n                name = 'upsInputFrequency'\n                conversion = lambda x:float(x)/10.0\n                unit = 'hertz'\n                group = 'group_frequency'\n            [[[[iso.3.6.1.2.1.33.1.3.3.1.3.1]]]]\n                name = 'upsInputVoltage'\n                unit = 'volt'\n                group = 'group_volt'\n            [[[[iso.3.6.1.2.1.33.1.4.1.0]]]]\n                name = 'upsOutputSource'\n            [[[[iso.3.6.1.2.1.33.1.4.2.0]]]]\n                name = 'upsOutputFrequency'\n                conversion = lambda x:float(x)/10.0\n                unit = 'hertz'\n                group = 'group_frequency'\n            [[[[iso.3.6.1.2.1.33.1.4.4.1.2.1]]]]\n                name = 'upsOutputVoltage'\n                conversion = lambda x:float(x)\n                unit = 'volt'\n                group = 'group_volt'\n            [[[[iso.3.6.1.2.1.33.1.4.4.1.3.1]]]]\n                name = 'upsOutputCurrent'\n                conversion = lambda x:float(x)/10.0\n                unit = 'amp'\n                group = 'group_amp'\n            [[[[iso.3.6.1.2.1.33.1.4.4.1.4.1]]]]\n                name = 'upsOutputPower'\n                conversion = None\n                unit = 'watt'\n                group ='group_power'\n            [[[[iso.3.6.1.2.1.33.1.4.4.1.5.1]]]]\n                name = 'upsOutputPercentLoad'\n                unit = 'percent'\n                group = 'group_percent'\n            # extra sensor data\n            [[[[iso.3.6.1.2.1.99.1.1.1.4.1]]]]\n                # cabinet temperature\n                name = 'cabTemp'\n                conversion = lambda x: float(x)/10.0\n                unit = 'degree_C'\n                group = 'group_temperature'\n            [[[[iso.3.6.1.2.1.99.1.1.1.4.2]]]]\n                # cabinet humidity\n                name = 'cabHumidity'\n                unit = 'percent'\n                group = 'group_percent'\n```\n\n### Default `[[[once]]]` section\n\nThis is the default `[[[once]]]` subsubsection that applies if no `[[[once]]]`\nsubsubsection is present. \n\n```\n        [[[once]]]\n            [[[[SNMPv2-MIB::sysDescr.0]]]]\n                oid = 'SNMPv2-MIB', 'sysDescr', 0\n                name = sysDescr\n            [[[[SNMPv2-MIB::sysObjectID.0]]]]\n                oid = 'SNMPv2-MIB', 'sysObjectID', 0\n                name = sysObjectID\n            [[[[SNMPv2-MIB::sysUpTime.0]]]]\n                oid = 'SNMPv2-MIB', 'sysUpTime', 0\n                name = sysUpTime\n            [[[[SNMPv2-MIB::sysContact.0]]]]\n                oid = 'SNMPv2-MIB', 'sysContact', 0\n                name = sysContact\n            [[[[SNMPv2-MIB::sysName.0]]]]\n                oid = 'SNMPv2-MIB', 'sysName', 0\n                name = sysName\n            [[[[SNMPv2-MIB::sysLocation.0]]]]\n                oid = 'SNMPv2-MIB', 'sysLocation', 0\n                name = sysLocation\n            [[[[SNMPv2-MIB::sysServices.0]]]]\n                oid = 'SNMPv2-MIB', 'sysServices', 0\n                name = sysServices\n            [[[[SNMPv2-MIB::sysORLastChange.0]]]]\n                oid = 'SNMPv2-MIB', 'sysORLastChange', 0\n                name = sysORLastChange\n```\n\n## OIDs\n\nSee [OIDs wiki page](https://github.com/roe-dl/weewx-snmp/wiki/OIDs)\n\n## References\n\n### SNMP\n\n* [Net-SNMP tools](http://www.net-snmp.org) \n  (contains `snmpget` and `snmpwalk` command line tool to retrieve\n  data from SNMP agents)\n* [SNMP tester for Windows](https://www.heise.de/download/product/paessler-snmp-tester-29883)\n\n### Python modules\n\n* [PySNMP documentation](https://pysnmp.readthedocs.io/en/latest/)\n* [PySNMP at Github](https://github.com/pysnmp/pysnmp)\n* [PyASN1 at Github](https://github.com/pysnmp/pyasn1)\n* [PySMI at Github](https://github.com/pysnmp/pysmi)\n\n### MIBs\n\n* http://www.oidview.com/mibs/0/SNMPv2-MIB.html\n* http://www.oidview.com/mibs/0/SNMPv2-SMI.html\n* http://www.oidview.com/mibs/0/UPS-MIB.html\n* https://www.circitor.fr/Mibs/Html/R/RFC1213-MIB.php\n* https://www.circitor.fr/Mibs/Html/E/ENTITY-SENSOR-MIB.php\n* [Private enterprise numbers](https://www.iana.org/assignments/enterprise-numbers/)\n\n### WeeWX\n\n* [WeeWX website](https://www.weewx.com)\n* [WeeWX information in german](https://www.woellsdorf-wetter.de/software/weewx.html)\n* [WeeWX customization guide](https://www.weewx.com/docs/customizing.htm)\n  (See this guide for using the observation types in skins.)\n* [WeeWX accumulators](https://github.com/weewx/weewx/wiki/Accumulators)\n  (This extension tries to set up reasonable accumulators for the\n  observation types, but if you want them different or if they do not\n  work appropriately, you can define them in `weewx.conf`)\n* [Calculation in templates](https://github.com/weewx/weewx/wiki/calculate-in-templates)\n* [WeeWX extension to monitor the computer WeeWX is running on](https://github.com/matthewwall/weewx-cmon)\n  (That is not related to SNMP, but to monitoring. It uses Linux tools.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froe-dl%2Fweewx-snmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froe-dl%2Fweewx-snmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froe-dl%2Fweewx-snmp/lists"}