htmon-agent 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +42 -8
- data/lib/htmon/agent/version.rb +1 -1
- data/lib/htmon/agent.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 151e5abf20a4ecff462a0754648c2b8c6be5c034
|
4
|
+
data.tar.gz: c7bf46b420084d8561b72c42108a51bdae31751d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f45355c6e13e88f42d7e017cd853fb1722a4c86625bc1855a89d1fe8b371527e546ea553a7df86117ddcf2aa0a5046b5e24c4ba597f8b485a15204914731cd0
|
7
|
+
data.tar.gz: 5c43697c9f8b3ed2fbc44dc38baf43c5fc60b89803a31ec08104e5406aa87b3425c93c29b70694b58e592d0f41c3b30fbd83ddc28995dcaca68f8f1bba738c9c
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Htmon::Agent
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Http Monitoring Agent - Compatible with Htmon ...
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,17 +20,53 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
The binary will create a loop, with should started by using systemd or any other kind of init system.
|
24
|
+
|
25
|
+
```bash
|
26
|
+
htmon-agent --config /tmp/htmon-agent.conf --api http://basic:auth@htmon.to:3000
|
27
|
+
```
|
28
|
+
|
29
|
+
The config could looks like the following snipped.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
schema = load_schema
|
33
|
+
|
34
|
+
check interval: 2.seconds do |url|
|
35
|
+
push url: :keepalive, expires_after: 10.seconds
|
36
|
+
end
|
37
|
+
|
38
|
+
schema["htmon_processes"].to_a.each do |process|
|
39
|
+
check interval: 1.minute do |url|
|
40
|
+
push metric: "process::#{process}",
|
41
|
+
expires_after: 2.minutes,
|
42
|
+
value: `pgrep -fla #{process.inspect} | grep -v pgrep | wc -l`.strip
|
43
|
+
end
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
Sample service file:
|
26
48
|
|
27
|
-
|
49
|
+
```bash
|
50
|
+
>>> systemctl cat htmon-agent
|
28
51
|
|
29
|
-
|
52
|
+
# /etc/systemd/system/htmon-agent.service
|
53
|
+
[Unit]
|
54
|
+
Description=Htmon Agent
|
55
|
+
After=network-online.target
|
30
56
|
|
31
|
-
|
57
|
+
[Service]
|
58
|
+
User=root
|
59
|
+
ExecStart=/usr/bin/htmon-agent --config /etc/htmon-agent.conf --api http://test:moo@rails.moo.gl:3000
|
60
|
+
RestartSec=60
|
61
|
+
Restart=always
|
62
|
+
|
63
|
+
[Install]
|
64
|
+
WantedBy=multi-user.target
|
65
|
+
```
|
32
66
|
|
33
67
|
## Contributing
|
34
68
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
69
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/timmyArch/htmon-agent.
|
36
70
|
|
37
71
|
|
38
72
|
## License
|
data/lib/htmon/agent/version.rb
CHANGED
data/lib/htmon/agent.rb
CHANGED
@@ -45,6 +45,11 @@ def check interval: 60, &block
|
|
45
45
|
Htmon::Agent.checks << Htmon::Agent::Check.new(block, interval)
|
46
46
|
end
|
47
47
|
|
48
|
+
def load_schema hostname: `hostname`
|
49
|
+
JSON.parse RestClient.get(Htmon::Agent.remote+
|
50
|
+
"schema?"+({hostname: hostname}).to_param)
|
51
|
+
end
|
52
|
+
|
48
53
|
def push url: nil, metric: nil, expires_after: nil, value: nil,
|
49
54
|
hostname: `hostname`.strip
|
50
55
|
logger = Logger.new(STDOUT)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htmon-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Foerster
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|