{"id":17383749,"url":"https://github.com/tomlobato/sys_watchdog","last_synced_at":"2025-04-15T10:05:48.444Z","repository":{"id":56896898,"uuid":"94703476","full_name":"tomlobato/sys_watchdog","owner":"tomlobato","description":"sys_watchdog keeps your *NIX servers green by performing periodic checks, service restarts and notifications.","archived":false,"fork":false,"pushed_at":"2017-09-27T00:50:55.000Z","size":310,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T10:05:26.754Z","etag":null,"topics":["alerts","cron","high-availability","linux","mmonit","monitor-website-uptime","monitoring","monitoring-server","nagios","notifications","pingdom","ruby","rubygem","server-management","shellscript","slack","sys-watchdog","sysadmin","systemd","unix"],"latest_commit_sha":null,"homepage":"http://sys-watchdog.bettercall.io","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomlobato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-18T17:49:51.000Z","updated_at":"2021-02-07T19:48:58.000Z","dependencies_parsed_at":"2022-08-21T01:50:32.259Z","dependency_job_id":null,"html_url":"https://github.com/tomlobato/sys_watchdog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Fsys_watchdog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Fsys_watchdog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Fsys_watchdog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Fsys_watchdog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomlobato","download_url":"https://codeload.github.com/tomlobato/sys_watchdog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249048730,"owners_count":21204306,"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":["alerts","cron","high-availability","linux","mmonit","monitor-website-uptime","monitoring","monitoring-server","nagios","notifications","pingdom","ruby","rubygem","server-management","shellscript","slack","sys-watchdog","sysadmin","systemd","unix"],"created_at":"2024-10-16T07:43:40.299Z","updated_at":"2025-04-15T10:05:48.418Z","avatar_url":"https://github.com/tomlobato.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"sys_watchdog\n=================\n\n[![Gem Version](https://badge.fury.io/rb/sys_watchdog.svg)](https://badge.fury.io/rb/sys_watchdog)\n[![Code Climate](https://codeclimate.com/github/tomlobato/sys_watchdog.svg)](https://codeclimate.com/github/tomlobato/sys_watchdog)\n![](http://ruby-gem-downloads-badge.herokuapp.com/sys_watchdog?type=total\u0026label=gem%20downloads)\n \nBy [Bettercall.io](https://bettercall.io/).\n\nsys_watchdog keeps your *NIX servers green by performing periodic checks and optionally actions like service restarts and notifications.  \n\nTake 20min to install and start to think what you\\`ll make with your spare time ;)\n\n## Install\n\nRequirements: Ruby 2.1+ (install on \n[Centos](https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-centos-7) \n[Debian](https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rvm-on-debian-8) \n[Ubuntu](https://gorails.com/setup/ubuntu/16.04))\n\n**Perform this and following steps logged as root user.**\n\n```\ngem install sys_watchdog\n```\n\nIf using Rbenv, run ```rbenv rehash``` to make sys_watchdog binary available.\n\n## Setup\n\n```\nsys_watchdog setup\n```\n\nEdit ```/etc/sys_watchdog.yml```. You can see example configurations in [util/sys_watchdog_sample.yml](https://github.com/tomlobato/sys_watchdog/blob/master/util/sys_watchdog_sample.yml) and [test/sys_watchdog_test.yml](https://github.com/tomlobato/sys_watchdog/blob/master/test/sys_watchdog_test.yml).  \n\n## Test run\n\nRun from command line:\n\n```\nsys_watchdog test\n``` \n\nIt will execute all system tests defined in ```/etc/sys_watchdog.yml``` and exit. You can use this to adjust your tests and get a grasp of the sys_watchdog operation.  \n\n## Start\n\nFinally, start the periodic run...\n\n```\nsys_watchdog start\n```\n\n\n## Command line Cli\n\n```\n# sys_watchdog help\nsys_watchdog v0.1.13\n\nUsage: sys_watchdog [setup|test|start|stop|once|uninstall|help|version]\n\nWhen called without options executes the system tests each 60 seconds. This is the normal operation when working with a system daemon starter like systemd or upstart.\n\nOptions:\n  setup        Create the configuration file, create the working directory and configure periodic run with systemd or cron.\n  test         Similar to once, but also sets the log output to STDOUT.\n  start        Start periodic run. If using systemd it will run 'systemctl start sys_watchdog'. If using cron it will enable/uncomment the cronjob line.  \n  stop         Stop periodic run.\n  once         Run tests once and exit, rather than run each 60 seconds which is the normal behavior.\n  uninstall    Deletes created files and services. After that, if you want to completlly uninstall, run 'gem uninstall sys_watchdog'.\n  -v, version  Prints version and exit.\n  -h, help     Prints the current message.\n```\n\n## Config Settings\n\n```config:```section of ```/etc/sys_watchdog.yml```:\n\nsetting      | description\n-------------|-------------------------------------------------------------------------------------------------\nname         | -\nserver_name  | -\nslack_token  | -\nslack_channel| -\nsmtp_server  | -\nsmtp_domain  | -\nmail_from    | -\nmail_to      | -\n\n## Sys Test Settings\n\n```tests:```section of ```/etc/sys_watchdog.yml```:\n\nsetting           | description\n------------------|-------------------------------------------------------------------------------------------\ntest_cmd                 | -\ntest_url                 | -\nnotify_on_output_change  | -\nrestore_cmd              | -\nexpected_regex           | -\nexpected_string          | -\nexpected_max             | -\nexpected_min             | -\n\n## Minimal /etc/sys_watchdog.yml\n\n```yml\nconfig:\n  name: My Website Server\n\n  smtp_server: smtp.mymailer.com\n  smtp_domain: mysite.com\n  mail_from: system@mysite.com\n  mail_to: \n    - myself@mysite.com\n\ntests:\n  site_status:\n    test_url: https://www.mysite.com\n\n  disk_root:\n    test_cmd: \"df / | grep -v Filesystem | awk '{print $5}' | sed 's/%//'\"\n    expected_max: 90\n    \n  worker_status:\n    test_cmd: ps aux | grep 'sidekiq 4.2.10 site'\n```\n\n## Full sample /etc/sys_watchdog.yml\n\n```yml\nconfig:\n  name: My Website Server\n  server_name: main website # if not present, `hostname` will be used\n\n  # Send alerts to Slack (create your slack token in https://github.com/slack-ruby/slack-ruby-client#usage)\n  # slack_token: xoxb-...\n  # slack_channel: '#alerts'\n\n  # Send email alerts (via any smtp server: https://sendgrid.com, https://postmarkapp.com/ or your own)\n  # smtp_server: smtp.mysite.com\n  # smtp_domain: mysite.com\n  # mail_from: system@mysite.com\n  # mail_to: \n  #   - myself@mysite.com\n\ntests:\n  ## General\n  boot_time:\n    notify_on_output_change: uptime -s\n\n  ## URLs\n  site_status:\n    test_url: https://www.mysite.com\n\n  # helpdesk_status:\n  #   test_url: https://helpdesk_status.mysite.com\n\n  ## Disks\n  disk_root:\n    test_cmd: \"df / | grep -v Filesystem | awk '{print $5}' | sed 's/%//'\"\n    expected_max: 90\n\n  # disk_shared_storage:\n  #   test_cmd: \"df /var/www/site/shared | grep -v Filesystem | awk '{print $5}' | sed 's/%//'\"\n  #   expected_max: 90\n\n  ## Mounts\n  # shared_storage:\n  #   test_cmd: mount | grep /var/www/site/shared\n\n  ## Services\n  # dns_server:\n  #   test_cmd: host -t A www.mysite.com ns1.mydns.com | tail -1\n  #   expected_regex: ^www.mysite.com has address\n  #   restore_cmd: systemctl restart bind9\n\n  # redis_server:\n  #   test_cmd: systemctl status redis-server\n  #   expected_string: Active: active (running)\n  #   restore_cmd: systemctl restart redis-server\n\n  ## Processes\n  # worker_status:\n  #   test_cmd: ps aux | grep 'sidekiq 4.2.10 site'\n```\n\n## Create a Slack Token\n\nFrom https://github.com/slack-ruby/slack-ruby-client ...  \n\nThis is something done in Slack, under [integrations](https://my.slack.com/services). Create a [new bot](https://my.slack.com/services/new/bot), and note its API token.\n\n![](images/register-bot.png)\n\n## Develop\n\n**Don\\`t need root privileges here.**\n\nDownload \u0026 install dependencies:  \n\n```\ngit clone https://github.com/tomlobato/sys_watchdog\ncd sys_watchdog\nbundle\n```\n\nRun code tests:  \n\n```\nchmod 0600 test/sys_watchdog_test.yml \nrake test\n```\n\nRun sys_watchdog tests:\n\n```\nruby -Ilib/ bin/sys_watchdog test\n```\n\nSend a PR and win a merge! Its free ;)\n\n## Copyright and License\n\nCopyright (c) 2017, [Bettercall.io](https://bettercall.io).\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomlobato%2Fsys_watchdog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomlobato%2Fsys_watchdog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomlobato%2Fsys_watchdog/lists"}