{"id":22419474,"url":"https://github.com/dunkelstern/pynsor","last_synced_at":"2026-02-14T00:10:41.640Z","repository":{"id":142590527,"uuid":"361839941","full_name":"dunkelstern/pynsor","owner":"dunkelstern","description":"A script to insert monitoring data into a Timescale DB","archived":false,"fork":false,"pushed_at":"2022-04-26T19:03:09.000Z","size":41,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T00:12:44.276Z","etag":null,"topics":["monitoring","sensor-data-collection","timescaledb"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dunkelstern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2021-04-26T17:40:22.000Z","updated_at":"2022-12-01T20:33:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"11313c8b-e2c4-47e0-94a7-01c9893a1352","html_url":"https://github.com/dunkelstern/pynsor","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/dunkelstern/pynsor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunkelstern%2Fpynsor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunkelstern%2Fpynsor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunkelstern%2Fpynsor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunkelstern%2Fpynsor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dunkelstern","download_url":"https://codeload.github.com/dunkelstern/pynsor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunkelstern%2Fpynsor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275934848,"owners_count":25555523,"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","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","sensor-data-collection","timescaledb"],"created_at":"2024-12-05T16:15:52.575Z","updated_at":"2025-09-19T12:11:11.010Z","avatar_url":"https://github.com/dunkelstern.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pynsor - Script to insert monitoring data into a Timescale DB\n\nThis project should be an equivalent to [telegraf](https://www.influxdata.com/time-series-platform/telegraf/)\nbut for the PostgreSQL based [TimescaleDB](https://www.timescale.com/)\n\n## Requirements\n\n- Python \u003e= 3.7\n- python `psutil` package\n- python `psycopg2` package\n- python `tomlkit` package\n\nOptional:\n\n- Ryzen power binary to read out per core energy consumption on Ryzen/Threadripper\n  based chips (see [Ryzen Power](https://github.com/dunkelstern/ryzen_power)\n- `ss` from `iproute2` for netstat (TCP Statistics)\n- `sensors` from `lm_sensors` for pretty sensor readouts (with named fields),\n  falls back to `psutil` method if not available\n- `smartctl` from `smartmontools` for HDD and SSD SMART monitoring\n\n## Changelog\n\n### 1.1.0 Smartctl\n\n- Add SMART monitoring for HDDs, SSDs and NVME devices\n\n### 1.0.0 Initial release\n\n- Initial release\n\n## Installation\n\n1. Install with `pip install pynsor`\n2. Create config file in `/etc/pynsor/pynsor.conf`, for example config see\n   `archlinux/pynsor.conf`\n3. Start with `pynsor --config /etc/pynsor/pynsor.conf`\n\nAll tables needed by the plugins that have been activated are created on\nstartup automatically (including their hypertables and some indices that\nmake sense).\n\nIf you want to run this as a `systemd` service, see `archlinux/pynsor.service`\nfor example unit file.\n\n\n## Configuration\n\nConfiguration is a single file that looks like this:\n\n```toml\n[global]\nrefresh = 10\nbatch_size = 1\n\n[db]\nhost = \"localhost\"\nport = 5432\nusername = \"monitoring\"\npassword = \"monitoring\"\ndb = \"monitoring\"\n\n[sensor.DiskStats]\nenabled = true\n\n[sensor.LMSensors]\nenabled = true\nsensors_binary = \"/usr/bin/sensors\"\nuse_fallback = false\n\n[sensor.Netstat]\nenabled = true\nss_binary = \"/usr/bin/ss\"\n\n[sensor.PSUtil]\nenabled = true\n\n[sensor.RyzenPower]\nenabled = false\nryzenpower_binary = \"/usr/bin/ryzen_power\"\n\n[sensor.ProcStat]\nenabled = true\n\n[sensor.SMARTCtl]\nenabled = true\n```\n\n- `global.refresh` defines how often to fetch a sensor reading (seconds)\n- `global.batch_size` if not set to `1`, collect `n` readings before writing\n  all of them to the DB... May conserve power by not stressing the DB too often.\n- `db` should be self explanatory\n- The `sensor` namespace is reserved for sensor configuration. The names of the\n  sensors are the python class names of the implementation. All sensors have\n  at least the `enabled` attribute which defaults to `true` and can be set to\n  `false` to disable running that particular sensor\n\n  \n## Available Plugins\n\n### DiskStats\n\n- Source: `/proc/diskstats`\n- Table: `diskstats`\n- Purpose: Disk performance counters\n\n### LMSensors\n\n- Source: `lm_sensors` or `sysfs` hwmon nodes (when used via `psutil` fallback)\n- Tables: `temps`, `voltage`, `fans`, `current`, `power`\n- Purpose: Active readout of sensors built into the computer\n\nThis plugin has a configuration:\n\n- `sensors_binary`: path to the `sensors` binary to use\n- `use_fallback`: fall-back to `psutil` even if `lm_sensors` is installed\n\n### Netstat\n\n- Source: `iproute2` binary `ss`\n- Table: `netstat`\n- Purpose: TCP networking statistics (established sockets, error states, etc.)\n\nThis plugin has a configuration:\n\n- `ss_binary`: path to the `ss` binary to use\n\n### PSUtil\n\n- Source: Various readings from `/proc` and `/sys`\n- Tables: `cpu_usage`, `cpu_freq`, `load_avg`, `processes`, `virtual_memory`,\n  `swap_memory`, `disk_usage`, `net_io_counters`, `disk_io_counters`\n- Purpose: Kernel statistics of differing origins\n\n### RyzenPower\n\n- Source: `ryzen_power` binary which reads CPU registers\n- Tables: `power`\n- Purpose: Read per-core and -package power usage from AMD Ryzen based CPUs\n\nThis plugin has a configuration:\n\n- `ryzenpower_binary`: path to the `ryzen_power` binary to use (attention:\n  this one is a SUID-root binary!)  \n\n### ProcStat\n\n- Source: `/proc/stat`\n- Tables: `cpu_usage_counters`, `kernel`\n- Purpose: RAW CPU usage counters and some other kernel information from the\n  kernel stats.\n \n### SMARTCtl\n\n- Source: `smartctl` (device needs to be accessible by script)\n- Tables: `sata_smart`, `nvme_smart`\n- Purpose: SMART status of disks\n\nThis plugin has a configuration:\n\n- `smartctl_binary`: path to the `smartctl` binary to use (or a wrapper script\n  that allows the user to access the disk device)\n- `disks`: disks to scan, you can use glob patterns (see default), if not set\n  defaults to `[ \"/dev/sd?\", \"/dev/sr?\", \"/dev/hd?\", \"/dev/nvme?n1\" ]`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdunkelstern%2Fpynsor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdunkelstern%2Fpynsor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdunkelstern%2Fpynsor/lists"}