dns_one 0.4.36 → 0.4.37
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/lib/dns_one/version.rb +1 -1
- data/util/dnsone_munin_ +53 -13
- 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: c2fc5f20cb89e4598dafa6f6629380674f751cb9
|
4
|
+
data.tar.gz: b607a3f8d376cd5f72c3f7a3fa19e7a8fa7efb18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd0c5a0208678999846c0832902699825e82e8bc9cfb301e8fbb2610f472b4bbf52462ca1714121e80b7833fefc1f19b3217660b6bc0f0457bd725e584002f2e
|
7
|
+
data.tar.gz: 0073ae574a4db7381f79bb11840924044f9b189dad97e775121bd5fec7ff52b91330aa6658d1a1aba6a594cb75d9cb34bef640dfedfb16b58d1f3f6c1ebb32bb
|
data/lib/dns_one/version.rb
CHANGED
data/util/dnsone_munin_
CHANGED
@@ -19,20 +19,29 @@ class MuninDnsOne
|
|
19
19
|
|
20
20
|
GRAPHS = {
|
21
21
|
rcode: {
|
22
|
-
|
23
|
-
|
22
|
+
percent: true,
|
23
|
+
vlabel: '%',
|
24
|
+
fields: %w(not_imp refused yx_domain yxrr_set nxrr_set not_auth not_zone badvers no_error badsig badkey badtime badmode nx_domain badalg badname form_err serv_fail).sort
|
24
25
|
},
|
25
26
|
req_resource: {
|
26
|
-
|
27
|
+
percent: true,
|
28
|
+
vlabel: '%',
|
27
29
|
fields: %w(a aaaa any cname hinfo minfo mx ns ptr soa txt wks)
|
28
30
|
},
|
29
31
|
cache: {
|
30
|
-
|
32
|
+
percent: true,
|
33
|
+
vlabel: '%',
|
31
34
|
fields: {
|
32
35
|
hit: 'Domain found in cache.',
|
33
36
|
miss: 'Domain not found in cache, requiring a backend access.',
|
34
37
|
},
|
35
38
|
},
|
39
|
+
requests: {
|
40
|
+
vlabel: 'count',
|
41
|
+
fields: {
|
42
|
+
requests: 'requests',
|
43
|
+
},
|
44
|
+
}
|
36
45
|
}
|
37
46
|
|
38
47
|
def initialize argv
|
@@ -58,29 +67,49 @@ class MuninDnsOne
|
|
58
67
|
GRAPHS[@param.graph]
|
59
68
|
end
|
60
69
|
|
70
|
+
def fields
|
71
|
+
if graph[:fields].is_a? Hash
|
72
|
+
graph[:fields]
|
73
|
+
else
|
74
|
+
_fields = {}
|
75
|
+
graph[:fields].each do |field|
|
76
|
+
_fields[field.to_sym] = field
|
77
|
+
end
|
78
|
+
_fields
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
61
82
|
def config
|
62
83
|
puts <<-CONFIG
|
63
|
-
graph_category
|
84
|
+
graph_category DnsOne
|
64
85
|
graph_title #{@param.graph}
|
65
86
|
graph_vlabel #{graph[:vlabel]}
|
66
87
|
graph_args --base 1000 -l 0
|
67
|
-
graph_info GI
|
68
88
|
|
69
89
|
CONFIG
|
70
90
|
|
71
|
-
|
72
|
-
k
|
73
|
-
v = Array === f ? f[1] : f
|
74
|
-
puts "#{k}.label #{v}"
|
91
|
+
fields.each_pair do |k, v|
|
92
|
+
puts "#{k}.label #{k}"
|
75
93
|
end
|
76
94
|
|
77
95
|
exit 0
|
78
96
|
end
|
79
97
|
|
80
98
|
def run
|
81
|
-
get_stats[@param.graph.to_s]
|
82
|
-
|
99
|
+
stats = get_stats[@param.graph.to_s]
|
100
|
+
|
101
|
+
if graph[:percent]
|
102
|
+
sum = stats.values.reduce(:+).to_f
|
103
|
+
end
|
104
|
+
|
105
|
+
fields.keys.each do |k|
|
106
|
+
value = stats[k] || 0.0
|
107
|
+
if graph[:percent]
|
108
|
+
value *= 100 / sum
|
109
|
+
end
|
110
|
+
puts "#{k}.value #{ value }"
|
83
111
|
end
|
112
|
+
|
84
113
|
exit 0
|
85
114
|
end
|
86
115
|
|
@@ -113,20 +142,27 @@ CONFIG
|
|
113
142
|
def fetch_stats
|
114
143
|
stat = {}
|
115
144
|
section = nil
|
145
|
+
|
116
146
|
`dns_one stats`.each_line do |l|
|
117
147
|
if l =~ /---\s*(\S+)\s*---/
|
118
148
|
section = $1
|
119
149
|
elsif l =~ /^(.*?)\s+(.*)$/
|
120
150
|
key = $1.to_sym
|
121
|
-
val = $2.strip
|
151
|
+
val = $2.strip.to_f
|
122
152
|
stat[section] ||= {}
|
123
153
|
stat[section][key] = val
|
124
154
|
end
|
125
155
|
end
|
156
|
+
|
157
|
+
stat["requests"] = {
|
158
|
+
requests: stat["cache"].values.reduce(:+).to_i
|
159
|
+
}
|
160
|
+
|
126
161
|
stat
|
127
162
|
end
|
128
163
|
|
129
164
|
def install
|
165
|
+
# Links
|
130
166
|
links = []
|
131
167
|
GRAPHS.keys.each do |graph_key|
|
132
168
|
links << graph_key
|
@@ -135,6 +171,10 @@ CONFIG
|
|
135
171
|
links.each do |link|
|
136
172
|
system "ln -s #{target} /etc/munin/plugins/dnsone_#{link}"
|
137
173
|
end
|
174
|
+
|
175
|
+
# munin_node_conf
|
176
|
+
munin_node_conf = "[dnsone_*]\nuser root\n\n"
|
177
|
+
File.open('/etc/munin/plugin-conf.d/munin-node', 'a').write munin_node_conf
|
138
178
|
end
|
139
179
|
|
140
180
|
def error msg
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dns_one
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lobato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|