{"id":14955546,"url":"https://github.com/sebyx07/stats-lite","last_synced_at":"2025-10-29T13:17:37.476Z","repository":{"id":54232616,"uuid":"212785788","full_name":"sebyx07/stats-lite","owner":"sebyx07","description":"Get system stats of your linux servers. CPU, RAM, HDD, extendable","archived":false,"fork":false,"pushed_at":"2023-01-20T07:25:29.000Z","size":101,"stargazers_count":9,"open_issues_count":9,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T14:15:19.707Z","etag":null,"topics":["devops","linux","monitoring","rails","rails5","ruby"],"latest_commit_sha":null,"homepage":"https://github.com/sebyx07/stats-lite","language":"Ruby","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/sebyx07.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-04T10:03:43.000Z","updated_at":"2022-05-19T14:36:55.000Z","dependencies_parsed_at":"2023-01-28T20:00:22.522Z","dependency_job_id":null,"html_url":"https://github.com/sebyx07/stats-lite","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/sebyx07%2Fstats-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebyx07%2Fstats-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebyx07%2Fstats-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebyx07%2Fstats-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sebyx07","download_url":"https://codeload.github.com/sebyx07/stats-lite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234723843,"owners_count":18877100,"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":["devops","linux","monitoring","rails","rails5","ruby"],"created_at":"2024-09-24T13:11:20.428Z","updated_at":"2025-10-01T18:31:23.037Z","avatar_url":"https://github.com/sebyx07.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# StatsLite\n\nSimple way to get server information as json. Easy to extend with a `config.rb` file.\nEmbeddable in Rails\n\n### Standalone usage\n\nRequirements ruby, min version 2\n\n\n```shell_script\nsudo apt-get install -y ruby build-essential ruby-dev\n```\n\nUsage standalone, you might need to run some commands as __sudo__.\n\n\n```shell_script\ngem install stats_lite --no-ri --no-rdoc\nstats-lite\ncurl http://localhost:9111\n```\n\nAdd to startup, crontab\n\n\n```shell_script\ncrontab -e\n# then add\n@reboot /usr/local/bin/stats-lite /home/deploy/.stats-lite/config.rb\n```\n\n![demo](https://raw.githubusercontent.com/sebyx07/stats-lite/master/docs/example.png)\n\ncreate a `config.rb` then `stats-lite`\n\n```ruby \n# example config.rb\n# basic usage\n\nStatsLite.configure do |s|\n  s.password \"1234\" # password protection\n  s.port 9111 # listening port\nend\n```\n\n```shell_script\n# now it's protected by passowrd\ncurl http://localhost:9111?password=1234 \n```\n\n### Rails usage\n\n`gem \"stats_lite\"`\n\n```ruby\n# routes.rb\nmount StatsLite::App =\u003e \"/server-stats\" \n```\n\n### Advanced configuration\n\n```ruby\n\nStatsLite.configure do |s, h|\n  s.password ENV[\"STATS_LITE_PASS\"] # defaults to nil, unprotected\n  s.port ENV[\"STATS_LITE_PORT\"] # defaults to 9111\n\n  s.data -\u003e (data) do # add more data\n    data[:ruby_current_time] = Time.now # simple value\n    data[:linux_time] = h.command(\"date\") # bash command, supports {cache: true, expires_in: 60} \n\n    data[:slow_command] = h.fetch :slow_command, -\u003e {\n      sleep 1\n      \"slow command\"\n    }, expires_in: 5 # cached ruby value\n  end\n\n  s.app do |sinatra| # extend the app, add multiple routes, which are protected by the password\n    sinatra.get(\"/another_route\") do\n      content_type :json\n\n      { cpus: h.command(\"nproc\", { cache: true }) }.to_json\n    end\n  end\n\n\n  s.rack do   # use rack builder, it's also password protected from above^\n    map \"/rack\" do\n      run lambda { |env| [200, {'Content-Type' =\u003e 'text/plain'}, ['OK']] }\n    end\n  end\n\n  s.cron do |rufus| # uses the Rufus scheduler, more details here https://github.com/jmettraux/rufus-scheduler\n    rufus.every \"5s\" do\n      print \"\\n cron job\"\n    end\n    rufus.every \"1h\" do\n      print \"\\n hourly cron job\"\n    end\n  end\nend\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebyx07%2Fstats-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebyx07%2Fstats-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebyx07%2Fstats-lite/lists"}