0.0
No commit activity in last 3 years
No release in over 3 years
HTTP Monitoring agent.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.0
~> 3.0

Runtime

 Project Readme

Htmon::Agent

Http Monitoring Agent - Compatible with Htmon ...

Installation

Add this line to your application's Gemfile:

gem 'htmon-agent'

And then execute:

$ bundle

Or install it yourself as:

$ gem install htmon-agent

Usage

The binary will create a loop, with should started by using systemd or any other kind of init system.

  htmon-agent --config /tmp/htmon-agent.conf --api http://basic:auth@htmon.to:3000

The config could looks like the following snipped.

schema = load_schema

check interval: 2.seconds do |url| 
  push url: :keepalive, expires_after: 10.seconds
end

check interval: 10.seconds do |url| 
  push metric: "load",
    value: File.read('/proc/loadavg').split[0..2].join(','), 
    expires_after: 50.seconds
end

check interval: 5.minutes do |url| 
  push metric: "packages::system",
    value: `pacman -Syup | grep 'pkg.tar.xz' -c`.to_i,
    expires_after: 30.minutes
end

check interval: 5.minutes do |url| 
  push metric: "packages::gems",
    value: `gem outdated | wc -l`.to_i,
    expires_after: 30.minutes
end

check interval: 5.minutes do |url| 
  push metric: "filesystemusage::root",
    value: `df -h | grep -P ' /$'`.split[4],
    expires_after: 30.minutes
end

schema["htmon_processes"].to_a.each do |process|
  check interval: 1.minute do |url| 
  push metric: "process::#{process}", 
    expires_after: 2.minutes, 
    value: `pgrep -fla #{process.inspect} | grep -v pgrep | wc -l`.strip
  end 
end

Sample service file:

>>> systemctl cat htmon-agent

# /etc/systemd/system/htmon-agent.service
[Unit]
Description=Htmon Agent
After=network-online.target

[Service]
User=root
ExecStart=/usr/bin/htmon-agent --config /etc/htmon-agent.conf --api http://test:moo@rails.moo.gl:3000
RestartSec=60
Restart=always

[Install]
WantedBy=multi-user.target

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/timmyArch/htmon-agent.

License

The gem is available as open source under the terms of the MIT License.