{"id":18622480,"url":"https://github.com/mindreframer/sheriff","last_synced_at":"2025-11-03T15:30:38.771Z","repository":{"id":5090302,"uuid":"6252777","full_name":"mindreframer/sheriff","owner":"mindreframer","description":"Web-based server monitoring and reporting, Scout-compatible.","archived":false,"fork":false,"pushed_at":"2013-11-12T16:20:42.000Z","size":2119,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T05:07:33.192Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":false,"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/mindreframer.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":"2012-10-16T22:28:24.000Z","updated_at":"2017-06-02T12:10:19.000Z","dependencies_parsed_at":"2022-07-31T12:18:00.362Z","dependency_job_id":null,"html_url":"https://github.com/mindreframer/sheriff","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/mindreframer%2Fsheriff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindreframer%2Fsheriff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindreframer%2Fsheriff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindreframer%2Fsheriff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mindreframer","download_url":"https://codeload.github.com/mindreframer/sheriff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239418544,"owners_count":19635203,"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":[],"created_at":"2024-11-07T04:17:21.371Z","updated_at":"2025-11-03T15:30:38.720Z","avatar_url":"https://github.com/mindreframer.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sheriff is a web-based tool for server monitoring and reporting.\n\n - keeps track of what was reported (historic values)\n - keeps track of who reported (hostname/ip)\n - distributes scout-compatible plugins to deputies (see [deputy](https://github.com/dawanda/deputy))\n - alerts via logging / email / sms when something goes wrong\n\n### Development server\n    git clone git@github.com:dawanda/sheriff.git\n    cd sheriff\n    bundle\n    cp config/config.yml.example config/config.yml\n    cp config/database.yml.example config/database.yml\n    rake db:create\n    rake db:migrate\n    rake #run tests\n    rails s\n\n### Generating test data\n\n    curl \"http://localhost:3000/notify?group=Cron.count_users\u0026value=123\"\n    # open \"http://localhost:3000/reports/1\"\n    # add a value validation (value: 1, warn via: email)\n    curl \"http://localhost:3000/notify?group=Cron.count_users\u0026value=123\"\n    # open \"http://localhost:3000/reports\"\n    # you should see an error =\u003e group (Cron) and subgroup (count_users) are marked as error\n\n### Reporting\nValues get pushed to Sheriff via http get e.g. curl but preferably via [deputy](https://github.com/dawanda/deputy)\n\n    curl \"http://localhost:3000/notify?group=Cron.count_users\u0026value=123\"\n    deputy Cron.count_users 123\n\n    # report the success/failure of script execution\n    ./database_backup ; deputy Cron.db_backup $?\n\n### Validations\nSheriff validates reported values against a set of validations to see if someone should be notified.\n\n - ValueValidation -- reported value matches `'x', 1, 1..5, /foo/`\n - RunEveryValidation -- reported every 10 minutes / only once per day\n - RunBetweenValidation -- reported between 00:00 and 02:00\n\n### Plugins\nPlugins can be stored and assigned to deputies/servers to run every x minutes/hours/days.\nThese plugins are compatible to Scout, so you can use these [50+ existing plugins](https://github.com/highgroove/scout-plugins) or build your own.\n\n    class Redis \u003c Scout::Plugin\n      def build_report\n        report :memory =\u003e `/opt/redis/redis-cli info | grep used_memory: | sed s/used_memory://`.strip\n      end\n    end\n\nPlugins are executed via `deputy --run-plugins`. deputy queries sheriff for plugins, assigned to this host and runs them if it's time to. The host is defined e.g. in:\n\n    #/etc/deputy.yml\n    sheriff_url: localhost:3000\n\n### Resque\nTo keep Sheriff responsive, report processing should be queued in [Resque](https://github.com/defunkt/resque).\u003cbr/\u003e\nInstall redis on localhost and set `resque: true` in config.yml\u003cbr/\u003e\n\n    # config.yml\n    resque: true\n\nIf activated, Resque workers are started on `cap deploy` and Resque status can be seen at your-sheriff-url.com/resque/overview\n\n### Hoptoad\nAdd hoptoad_api_key to config.yml to get errors reported to [Hoptoad](http://hoptoadapp.com).\n\n### Newrelic\nIf you want performance analysis via [Newrelic](https://newrelic.com), add your `config/newrelic.yml`\n\n# Demo / Heroku\nYou can play around with the demo at [sheriff.heroku.com](sheriff.heroku.com),\nits public, so people will make crazy/dangerous plugins.\u003cbr/\u003e\n**Do not run plugins via deputy**.\u003cbr/\u003e\nOnly ValueValidations work, since there are no cron jobs.\n\n    # configure deputy via /etc/deputy.yml or ~/.deputy.yml\n    sheriff_url: http://sheriff.heroku.com\n\n    # report a value\n    deputy Foo.bar 111\n\n    # run plugins written by annonymouse pranksters\n    deputy --run-plugins --no-wait\n\n**To run your own setup**\u003cbr/\u003e\nSetup your heroku account\n\n    git clone https://github.com/dawanda/sheriff.git\n    cd sheriff\n    heroku create my-sheriff\n\nMake a config in config/config.heroku.yml\n\n    sh/configure_heroku.rb\n    git ps heroku\n\n# Setup on normal server\nSheriff is Rails app deployed via capistrano. It needs:\n\n - Relational database (tested with MySql/Postgres)\n - Rack server (tested with passenger)\n - Mail setup in e.g. sheriff/shared/config/initializers/mail.rb\n - (Optional) Resque for higher responsiveness / no timeouts\n - (Optional) goyyamobile.com account for sms notifications\n - (Optional) Newrelic account for performance analysis\n - (Optional) Hoptoad account for error reporting\n\n### Commands\nFor user 'deploy' group 'users' in /srv/sheriff\n\n    # on server:\n    sudo su\n    cd /srv\n    mkdir sheriff\n    chown users:deploy -R sheriff\n\n    sudo su deploy\n    cd /srv/sheriff\n    mkdir -p shared/config\n    mkdir -p shared/log\n    mkdir -p shared/pids\n    --- add customized shared/config/config.yml + database.yml [+ newrelic.yml]\n\n    # from your box\n    bundle exec cap deploy\n\n### Server\nUse anything rack-ish e.g. `passenger start [OPTIONS]`\n    passenger start --port 3000 --address myhost.com --environment production --max-pool-size 1\n\nor add via normal apache/nginx config.\n\n### Logrotate\nDont let those log-files grow!\n\n    sudo ln -s /srv/sheriff/current/config/logrotate /etc/cron.d/sheriff\n\n### Cron\nTo notice when a report is missing we need a cron to check for it.\n\n    * * * * * cd /srv/sheriff/current \u0026\u0026 RAILS_ENV=production ruby sh/cron_minute.rb \u0026\u0026 deputy Cron.sheriff\n\n# TODO\n - remove capistrano-ext dependency\n - make sms provider configurable (create a gem for that ?)\n - make 1.9 compatible\n - highlight and notify any new error/alert message \u003c-\u003e set them to default email -\u003e user can adjust down\n - make plugin OPTIONS configurable\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindreframer%2Fsheriff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindreframer%2Fsheriff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindreframer%2Fsheriff/lists"}