{"id":26455097,"url":"https://github.com/tomsh-hr/pingstat","last_synced_at":"2026-04-13T13:01:58.068Z","repository":{"id":282020787,"uuid":"947211334","full_name":"tomsh-hr/pingstat","owner":"tomsh-hr","description":"A lightweight, user-level script for multi-server ping logging, storing stats per server in user-writable SQLite databases.","archived":false,"fork":false,"pushed_at":"2025-03-21T21:07:08.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-18T15:57:24.407Z","etag":null,"topics":["bash","linux","ping","server"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomsh-hr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2025-03-12T10:27:28.000Z","updated_at":"2025-03-21T19:44:24.000Z","dependencies_parsed_at":"2025-06-07T23:48:22.707Z","dependency_job_id":null,"html_url":"https://github.com/tomsh-hr/pingstat","commit_stats":null,"previous_names":["tomsh-hr/pingstat"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tomsh-hr/pingstat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomsh-hr%2Fpingstat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomsh-hr%2Fpingstat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomsh-hr%2Fpingstat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomsh-hr%2Fpingstat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomsh-hr","download_url":"https://codeload.github.com/tomsh-hr/pingstat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomsh-hr%2Fpingstat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31753551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bash","linux","ping","server"],"created_at":"2025-03-18T20:30:00.520Z","updated_at":"2026-04-13T13:01:57.995Z","avatar_url":"https://github.com/tomsh-hr.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pingstat\n\nA lightweight, user-level script for multi-server ping logging, storing stats per server in user-writable SQLite databases.\n\n---\n\n## Example Output\n\n```bash\npingstat -d\n```\n\n```bash\nday         abs_min  avg_min  avg_avg  avg_max  abs_max  avg_loss  weekday    num_pings\n----------  -------  -------  -------  -------  -------  --------  ---------  ---------\n2025-03-09  0.056    0.083    0.133    0.183    1.171    0.0%      Sunday     56       \n2025-03-08  0.052    0.084    0.132    0.182    0.323    0.0%      Saturday   96       \n2025-03-07  0.055    0.096    0.146    0.188    0.265    8.3%      Friday     96       \n2025-03-06  0.053    0.073    0.104    0.135    0.237    3.2%      Thursday   94       \n2025-03-05  0.055    0.084    0.128    0.167    0.235    0.0%      Wednesday  96       \n2025-03-04  0.056    0.090    0.138    0.191    1.111    1.0%      Tuesday    96       \n2025-03-03  0.054    0.097    0.142    0.183    0.231    5.4%      Monday     37       \n2025-03-02  0.058    0.079    0.124    0.179    0.316    12.5%     Sunday     24       \n2025-03-01  0.059    0.087    0.132    0.174    0.223    4.2%      Saturday   24       \n2025-02-28  0.060    0.085    0.136    0.184    0.229    0.0%      Friday     28       \n2025-02-27  0.056    0.063    0.093    0.135    0.168    0.0%      Thursday   4        \n-------------------------------------------------------------------------------------\n\nNote: Times are in milliseconds (ms), and packet loss in %.\n```\n\n### **Stat Definitions**\n\n- **abs_min** – absolute minimum (quickest response of the day/month).\n- **avg_min** – average minimum ping over the day.\n- **avg_avg** – average ping of all requests for that day.\n- **avg_max** – average of the maximum ping values recorded.\n- **abs_max** – absolute maximum (the slowest response recorded).\n- **avg_loss** – average packet loss percentage for the day/month.\n- **weekday** – day of the week (only for the -d flag).\n- **num_pings** – number of pings for the day/month.\n\n---\n\n## Features\n\n✅ **Manage multiple servers** (`add`, `remove`, `list`) without manually editing config files.  \n✅ **Log ping statistics** (`min/avg/max/mdev/loss`) into a dedicated SQLite `.db` file per server.  \n✅ **View historical stats** with daily (`-d`) or monthly (`-m`) aggregation.  \n✅ **Minimal dependencies** – requires only `bash`, `ping`, `sqlite3`, and `curl` or `wget` (for install).  \n✅ **Automate pings** using `cron` for long-term monitoring.  \n\n---\n\n## Installation\n\n### **System-wide Installation** (Requires `sudo` but only for installation!)\n\n```bash\nwget -q \"https://codeberg.org/tomsh/pingstat/raw/branch/main/install\" -O install.sh \u0026\u0026 sudo bash install.sh \u0026\u0026 rm install.sh\n```\nor (if you prefer curl):\n\n```bash\ncurl -sL \"https://codeberg.org/tomsh/pingstat/raw/branch/main/install\" -o install.sh \u0026\u0026 sudo bash install.sh \u0026\u0026 rm install.sh\n```\n\nThis installs `pingstat` in `/usr/bin/`, making it available to all users.\n\n### **User-Level Installation** (No `sudo`)\n\n```bash\nwget -q \"https://codeberg.org/tomsh/pingstat/raw/branch/main/install\" -O install.sh \u0026\u0026 bash install.sh \u0026\u0026 rm install.sh\n```\n\nor:\n\n```bash\ncurl -sL \"https://codeberg.org/tomsh/pingstat/raw/branch/main/install\" -o install.sh \u0026\u0026 bash install.sh \u0026\u0026 rm install.sh\n```\n*(Ensure `~/bin` is in your `$PATH` to run `pingstat` easily.)*\n\n### **Install a Specific Version** (e.g., `1.1.0`)\n\n```bash\nwget -q \"https://codeberg.org/tomsh/pingstat/raw/branch/main/install\" -O install.sh \u0026\u0026 sudo bash install.sh 1.1.0 \u0026\u0026 rm install.sh\n```\n\nor:\n\n```bash\ncurl -sL \"https://codeberg.org/tomsh/pingstat/raw/branch/main/install\" -o install.sh \u0026\u0026 sudo bash install.sh 1.1.0 \u0026\u0026 rm install.sh\n```\n\n---\n\n## Basic Usage\n\n```bash\npingstat \u003ccommand\u003e [options]\n```\n\n### **Server Management**\n- `pingstat add \u003cserver\u003e` → Add a server (e.g., `kernel.org`).  \n- `pingstat remove \u003cserver\u003e` → Remove a server from the list.  \n- `pingstat list` → List all configured servers.  \n\n### **Ping \u0026 Stats**\n- `pingstat -p` → Ping all servers (or use `-s \u003cserver\u003e` for one).  \n- `pingstat -d [N]` → Show daily stats for the last `N` days (default: 20).  \n- `pingstat -m [N]` → Show monthly stats for the last `N` months (default: 12).  \n- `pingstat -s \u003cserver\u003e` → Apply `-p`, `-d`, or `-m` to a specific server.  \n\n### **Examples**\n```bash\npingstat add kernel.org\npingstat add gnu.org\npingstat list\n```\n\n```bash\npingstat -p        # Ping all servers\npingstat -p -s gnu.org  # Ping only gnu.org\npingstat -d 5      # Show last 5 days' stats\npingstat -d 5 -s gnu.org  # Last 5 days for gnu.org only\npingstat remove gnu.org  # Remove gnu.org from the list\n```\n\n---\n\n## Automating with Cron\n\nTo ping **all** servers every **5 minutes**, edit your crontab (`crontab -e`) and add:\n\n```cron\n*/5 * * * * pingstat -p\n```\n\nFor a single server:\n\n```cron\n*/5 * * * * pingstat -p -s kernel.org\n```\n\n---\n\n## Updating\n\nTo update to the latest version:\n\n```bash\npingstat --update\n```\n\nOr manually by running install script as described above.\n\n---\n\n## Uninstalling\n\nTo remove `pingstat`, run:\n\n```bash\npingstat --uninstall\n```\n\nOr manually remove:\n\n```bash\nsudo rm /usr/bin/pingstat  # System-wide install\nrm -rf ~/.config/pingstat        # User config\nrm -rf ~/.local/share/pingstat   # User data\n```\n*(Adjust paths if you installed locally.)*\n\n---\n## Troubleshooting\n\n### Script exits silently with no output?\n\nIf you're using a custom config or modified version, ensure your config file is valid Bash syntax:\n\n```bash\ncat ~/.config/pingstat/servers.conf\n```\nA working config might look like:\n```bash\nSERVERS=\"kernel.org gnu.org\"\n```\nIf it's empty or corrupted, just delete it:\n```bash\nrm ~/.config/pingstat/servers.conf\n```\nIf that doesn’t help, try reinstalling `pingstat` (this will not delete your current data):\n```bash\npingstat --force-update\n```\nAnd if that still doesn’t help, there may be a bug in the script (oops — my fault 😅).\nAs a quick workaround, you can comment out this line in the script:\n```bash\nset -euo pipefail\n```\n⚠️ Only do this if you know what you’re doing, and please open an issue so I can fix the root cause.\n\n## License\n\nLicensed under [MIT](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomsh-hr%2Fpingstat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomsh-hr%2Fpingstat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomsh-hr%2Fpingstat/lists"}