htmon-icinga 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 975f860c3dbe63fa993da6d88ed798598d07050b
4
- data.tar.gz: 8107e4dbfa9b736eeaeed59a74142ba3a5fd87b3
3
+ metadata.gz: 545db68aa0335dee493753e2fa7d995d03bacb58
4
+ data.tar.gz: 7969df986a3146432943b3fbcb772531b4fe61a6
5
5
  SHA512:
6
- metadata.gz: 49794963fa57bb71e01a6b103cf175fc33d1482629a7f0eb5f8431ffbfc4ab3cb952ba7c6b17ef51cf48bdea8367d0d545bab806bb091f1857d29824d2972a27
7
- data.tar.gz: 26251938ccfe89451a5868225bdd30ef5c63248d43a8fd6d4c2555841285d41e64988de58b620056b78efae809d5ae23920cc5823565ebe0ff2efcd3bb6e8df4
6
+ metadata.gz: 16f76b538f7531ef988376ab4b1ac028eb510fbcb012546008c91bb39615e68aefd244761a0eb363b0f3c33dc58576ffa90468d310c43fbd0030eb5fb44dba5a
7
+ data.tar.gz: da9d179d5b6e2c2de144d609bbe7edf0027cf23023c4663a6f9f4ada5e82e98a337ce8e9776b39bc89c4c10c99948f7d92b2d6cb7a9ba671454c1d4972708864
@@ -0,0 +1,41 @@
1
+ template CheckCommand "htmon-command" {
2
+
3
+ import "plugin-check-command"
4
+
5
+ arguments = {
6
+ "--url" = "$htmon_url$"
7
+ "--metric" = "$htmon_metric$"
8
+ "--hostname" = "$htmon_hostname$"
9
+ "--warn" = {
10
+ set_if = "$htmon_warn$"
11
+ value = "$htmon_warn$"
12
+ }
13
+ "--tresh" = {
14
+ set_if = "$htmon_thresh$"
15
+ value = "$htmon_thresh$"
16
+ }
17
+ }
18
+
19
+ vars.htmon_url = "redis://192.168.1.102"
20
+ vars.htmon_hostname = null
21
+ vars.htmon_warn = null
22
+ vars.htmon_thresh = null
23
+ }
24
+
25
+ object CheckCommand "htmon-keepalive" {
26
+ import "htmon-command"
27
+
28
+ command = [ LocalBin + "/check_htmon" ]
29
+
30
+ vars.htmon_metric = "keepalive"
31
+ }
32
+
33
+ object CheckCommand "htmon-process" {
34
+ import "htmon-command"
35
+
36
+ command = [ LocalBin + "/check_htmon" ]
37
+
38
+ vars.htmon_metric = "process::$htmon_process$"
39
+ }
40
+
41
+
@@ -0,0 +1 @@
1
+ const LocalBin = "/usr/local/bin"
@@ -0,0 +1,13 @@
1
+ object Host "sample.moo.gl" {
2
+ import "generic-host"
3
+ address = "127.0.0.1"
4
+
5
+ vars.htmon_processes = [
6
+ "nginx", "apache2", "sshd",
7
+ "mysqld", "nspawn"
8
+ ]
9
+
10
+ vars.htmon_hostname = "peter.moo.gl"
11
+
12
+ }
13
+
@@ -0,0 +1,20 @@
1
+ apply Service "htmon_keepalive" {
2
+ import "generic-service"
3
+
4
+ check_command = "htmon-keepalive"
5
+
6
+ vars.htmon_hostname = host.vars.htmon_hostname
7
+ assign where host.vars.htmon_hostname
8
+ }
9
+
10
+ apply Service "process " for (process in host.vars.htmon_processes) {
11
+ import "generic-service"
12
+
13
+ check_command = "htmon-process"
14
+
15
+ vars.htmon_process = process
16
+ vars.htmon_hostname = host.vars.htmon_hostname
17
+ assign where host.vars.htmon_processes != null
18
+ }
19
+
20
+
@@ -116,4 +116,6 @@ end
116
116
 
117
117
  require_relative 'modules/keepalive'
118
118
  require_relative 'modules/process'
119
+ require_relative 'modules/packages'
120
+ require_relative 'modules/load'
119
121
 
@@ -0,0 +1,30 @@
1
+
2
+ module Htmon
3
+ module Icinga
4
+ class Module
5
+ class Load < Module
6
+
7
+ Value ||= Struct.new(:avg1,:avg5,:avg15)
8
+
9
+ callback :handle_value do |value, metric|
10
+ Value.new(*metric.split("::").last.to_s.split(','))
11
+ end
12
+
13
+ callback :on_ok do |value, warn, thresh|
14
+ if value.avg5 < warn.to_i
15
+ "Load values are #{value.avg1}, #{value.avg5}, #{value.avg1}"+
16
+ "| avg1=#{value.avg1} avg5=#{value.avg5},#{warn.to_i} avg15=#{value.avg15}"
17
+ end
18
+ end
19
+
20
+ callback :on_warn do |value, warn, thresh|
21
+ if value.avg5 >= warn.to_i
22
+ "Load values are #{value.avg1}, #{value.avg5}, #{value.avg1}"+
23
+ "| avg1=#{value.avg1} avg5=#{value.avg5},#{warn.to_i} avg15=#{value.avg15}"
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,24 @@
1
+
2
+ module Htmon
3
+ module Icinga
4
+ class Module
5
+ class Packages < Module
6
+
7
+ callback :on_ok do |value, warn, thresh|
8
+ if value.amount < warn.to_i
9
+ "#{value} packages are out of date."+
10
+ "| packages=#{value.amount}"
11
+ end
12
+ end
13
+
14
+ callback :on_warn do |value, warn, thresh|
15
+ if value.amount >= warn.to_i
16
+ "#{value} packages are out of date, update needed."+
17
+ "| packages=#{value.amount},#{warn.to_i}"
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  module Htmon
2
2
  module Icinga
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmon-icinga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.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-10 00:00:00.000000000 Z
11
+ date: 2016-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -99,9 +99,15 @@ files:
99
99
  - bin/setup
100
100
  - exe/check_htmon
101
101
  - htmon-icinga.gemspec
102
+ - icinga_conf/commands.conf
103
+ - icinga_conf/constants.conf
104
+ - icinga_conf/hosts.conf
105
+ - icinga_conf/services.conf
102
106
  - lib/htmon/icinga.rb
103
107
  - lib/htmon/icinga/module.rb
104
108
  - lib/htmon/icinga/modules/keepalive.rb
109
+ - lib/htmon/icinga/modules/load.rb
110
+ - lib/htmon/icinga/modules/packages.rb
105
111
  - lib/htmon/icinga/modules/process.rb
106
112
  - lib/htmon/icinga/version.rb
107
113
  homepage: https://github.com/timmyArch/htmon-icinga