dribbled 0.6.0 → 0.7.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.
- data/README.md +45 -3
- data/lib/dribbled/cli.rb +4 -4
- data/lib/dribbled/drbd.rb +10 -4
- data/lib/dribbled/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
# SYNOPSIS
|
8
8
|
|
9
9
|
dribbled [options] <action> [options]
|
10
|
+
|
11
|
+
Actions are one of `show`, `check`, `snap`.
|
10
12
|
|
11
13
|
Options are as follows:
|
12
14
|
|
@@ -20,18 +22,28 @@ Options are as follows:
|
|
20
22
|
-V, --version Display dribbled version
|
21
23
|
--help Show this messageSenedsa options
|
22
24
|
|
23
|
-
With no options or arguments, `dribbled` displays help
|
25
|
+
With no options or arguments, `dribbled` displays help as shown above (unless called as `check_drbd`; see _Personalities_).
|
24
26
|
|
25
27
|
# PERSONALITIES
|
26
28
|
|
27
|
-
*Dribbled* has two personalities: when run as `dribbled`, it behaves according to the action and parameters used; when run as `check_drbd`, it assumes the `check` action, which enables Nagios plugin behavior.
|
29
|
+
*Dribbled* has two personalities: when run as `dribbled`, it behaves according to the action and parameters used; when run as `check_drbd`, it assumes the `check` action, which enables Nagios plugin behavior. (i.e., `dribbled check` is equivalent to `check_drbd`).
|
30
|
+
|
31
|
+
# ACTIONS
|
32
|
+
|
33
|
+
## Show
|
34
|
+
|
35
|
+
The `show` action displays information about DRBD devices in the system. This action currently accepts no options.
|
28
36
|
|
29
37
|
gerir@boxie:~:dribbled show
|
30
|
-
0 r0 Connected UpToDate/UpToDate Secondary/Primary
|
38
|
+
0 r0 Connected UpToDate/UpToDate Secondary/Primary sourcehost /dev/drbd0 desthost /dev/drbd0
|
31
39
|
1 r1 Connected UpToDate/UpToDate Secondary/Primary sourcehost /dev/drbd1 desthost /dev/drbd1
|
32
40
|
5 r5 Connected UpToDate/UpToDate Secondary/Primary sourcehost /dev/drbd5 desthost /dev/drbd5
|
33
41
|
6 r6 SyncTarget [ 4%] Inconsistent/UpToDate Secondary/Primary sourcehost /dev/drbd6 desthost /dev/drbd6
|
34
42
|
|
43
|
+
## Check
|
44
|
+
|
45
|
+
The `check` action enables Nagios plugin mode, in which a single line of output is produced on `STDOUT` with the status of the devices.
|
46
|
+
|
35
47
|
gerir@boxie:~:dribbled check
|
36
48
|
warning: 6:cs:SyncTarget[4.6%%];ds:Inconsistent/UpToDate
|
37
49
|
|
@@ -40,3 +52,33 @@ With no options or arguments, `dribbled` displays help (as shown above).
|
|
40
52
|
|
41
53
|
Currently, there is no way to configure what constitutes alert conditions, but generally, a **critical** alert will be generated when a resource is found in non-`Connected` and non-`UpToDate` state, except when said resource is in `SyncSource`, `SyncTarget`, `VerifyS`, `VerifyT`, `PausedSyncS`, `PausedSyncT`, or `StandAlone` connection state, which causes a **warning**. Also, resources that are `Connected` and `UpToDate` but missing from the configuration will generate a **warning**.
|
42
54
|
|
55
|
+
Both active and passive modes are supported, with the corresponding options:
|
56
|
+
|
57
|
+
Check Options
|
58
|
+
-M, --monitor [nagios] Monitoring system
|
59
|
+
-m, --mode [active|passive] Monitoring mode
|
60
|
+
-H, --nsca_hostname HOSTNAME NSCA hostname to send passive checks
|
61
|
+
-c, --config CONFIG Path to Senedsa (send_nsca) configuration
|
62
|
+
-S, --svc_descr SVC_DESR Nagios service description
|
63
|
+
-h, --hostname HOSTNAME Service hostname
|
64
|
+
|
65
|
+
As `dribbled` uses [Senedsa](https://github.com/evernote/ops-senedsa "Senedsa"), configurations files are supported.
|
66
|
+
|
67
|
+
## Snap
|
68
|
+
|
69
|
+
The `snap` action is useful to capture raw data DRBD from a system for test and development. It produces two files, `xmldump.`_suffix_ and `proddrbd.`_suffix_:
|
70
|
+
|
71
|
+
Snap Options
|
72
|
+
-S, --suffix SUFFIX Suffix (defaults to PID)
|
73
|
+
-D, --directory DIRECTORY Directory (defaults to /tmp)
|
74
|
+
|
75
|
+
These files can then be used with the general `--procdrbd PROCDRBD` and `--xmldump XMLDUMP` options:
|
76
|
+
|
77
|
+
gerir@boxie:~/dribbled -P data/procdrbd.wfconnection -X data/xmldump.wfconnection -H sourcehost show
|
78
|
+
0 r0 Connected UpToDate/UpToDate Primary/Secondary sourcehost /dev/drbd0 desthost /dev/drbd0
|
79
|
+
1 r1 Connected UpToDate/UpToDate Primary/Secondary sourcehost /dev/drbd1 desthost /dev/drbd1
|
80
|
+
12 r12 Connected UpToDate/UpToDate Primary/Secondary sourcehost /dev/drbd12 desthost /dev/drbd12
|
81
|
+
13 r13 WFConnection UpToDate/DUnknown Primary/Unknown
|
82
|
+
|
83
|
+
We use the general `-H` option to let `dribbled` know which host the commands were captured on (so that it can properly identify source and destination).
|
84
|
+
|
data/lib/dribbled/cli.rb
CHANGED
@@ -194,9 +194,9 @@ module Dribbled
|
|
194
194
|
unless po_cstate.gsub('cs:','').empty? and po_dstate.gsub('ds:','').empty?
|
195
195
|
if ['SyncSource','SyncTarget','VerifyS','VerifyT','PausedSyncS','PausedSyncT','StandAlone'].include? res.cstate
|
196
196
|
plugin_status = :warning
|
197
|
-
plugin_output += res.percent.nil? ? " #{res.id}:#{po_cstate};#{po_dstate}" : " #{res.id}:#{po_cstate}[#{res.percent}
|
197
|
+
plugin_output += res.percent.nil? ? " #{res.id}:#{po_cstate};#{po_dstate}" : " #{res.id}:#{po_cstate}[#{res.percent}%,#{res.finish}];#{po_dstate}"
|
198
198
|
elsif not res.in_configuration?
|
199
|
-
plugin_status = :
|
199
|
+
plugin_status = :ok
|
200
200
|
plugin_output += " #{res.id}[unconfigured]>#{po_cstate}/;#{po_dstate}"
|
201
201
|
else
|
202
202
|
plugin_output += " #{res.id}>#{po_cstate};#{po_dstate}"
|
@@ -212,12 +212,12 @@ module Dribbled
|
|
212
212
|
when :nagios
|
213
213
|
case @action_options[:mode]
|
214
214
|
when :active
|
215
|
-
puts "#{plugin_status}:#{plugin_output}"
|
215
|
+
puts "#{plugin_status.to_s.upcase}:#{plugin_output}"
|
216
216
|
exit SendNsca::STATUS[plugin_status]
|
217
217
|
when :passive
|
218
218
|
sn = SendNsca.new @action_options
|
219
219
|
begin
|
220
|
-
sn.send plugin_status
|
220
|
+
sn.send plugin_status, plugin_output
|
221
221
|
rescue SendNsca::SendNscaError => e
|
222
222
|
output_message "send_nsca failed: #{e.message}", 1
|
223
223
|
end
|
data/lib/dribbled/drbd.rb
CHANGED
@@ -11,7 +11,8 @@ module Dribbled
|
|
11
11
|
PROCDRBD_VERSION_RE = /^version:\s+(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)\s+\(api:(?<api>\d+)\/proto:(?<proto>[0-9-]+)/
|
12
12
|
PROCDRBD_RESOURCE_RE = /^\s*(?<id>\d+):\s+cs:(?<cstate>[\w\/]+)\s+(st|ro):(?<state>[\w\/]+)\s+ds:(?<dstate>[\w\/]+)\s+/
|
13
13
|
PROCDRBD_URESOURCE_RE = /^\s*(?<id>\d+):\s+cs:(?<cstate>[\w\/]+)/
|
14
|
-
PROCDRBD_ACTIVITY_RE = /^\s+\[[.>=]+\]\s+(?<activity>[a-z']+):\s+(?<percent>[0-9.]+)
|
14
|
+
PROCDRBD_ACTIVITY_RE = /^\s+\[[.>=]+\]\s+(?<activity>[a-z']+):\s+(?<percent>[0-9.]+)%\s+\(\d+\/\d+\)M(finish:\s+(?<finish>[0-9:]+)\s+)*/
|
15
|
+
PROCDRBD_ACTIVITY_STATUS_RE = /^\s+finish:\s+(?<finish>[0-9:]+)\s+/
|
15
16
|
|
16
17
|
def initialize(options)
|
17
18
|
@log = options[:log].nil? ? nil : options[:log]
|
@@ -63,6 +64,10 @@ module Dribbled
|
|
63
64
|
m = PROCDRBD_ACTIVITY_RE.match(line)
|
64
65
|
resources_run[r].activity = m[:activity].gsub(/'/,"").to_sym
|
65
66
|
resources_run[r].percent = m[:percent].to_f
|
67
|
+
resources_run[r].finish = m[:finish]
|
68
|
+
elsif PROCDRBD_ACTIVITY_STATUS_RE.match(line)
|
69
|
+
m = PROCDRBD_ACTIVITY_STATUS_RE.match(line)
|
70
|
+
resources_run[r].finish = m[:finish]
|
66
71
|
elsif PROCDRBD_VERSION_RE.match(line)
|
67
72
|
@version_major = $1
|
68
73
|
@version_minor = $2
|
@@ -133,7 +138,7 @@ module Dribbled
|
|
133
138
|
class DrbdResource
|
134
139
|
|
135
140
|
attr_reader :id
|
136
|
-
attr_accessor :name, :cstate, :dstate, :state, :config, :primary, :secondary, :activity, :percent, :in_kernel, :in_configuration
|
141
|
+
attr_accessor :name, :cstate, :dstate, :state, :config, :primary, :secondary, :activity, :percent, :finish, :in_kernel, :in_configuration
|
137
142
|
|
138
143
|
def initialize(res,hostname)
|
139
144
|
@id = res
|
@@ -144,6 +149,7 @@ module Dribbled
|
|
144
149
|
@state = nil
|
145
150
|
@activity = nil
|
146
151
|
@percent = nil
|
152
|
+
@finish = nil
|
147
153
|
@primary = { :hostname => nil, :disk => nil, :device => nil }
|
148
154
|
@secondary = { :hostname => nil, :disk => nil, :device => nil }
|
149
155
|
@in_kernel = false
|
@@ -170,9 +176,9 @@ module Dribbled
|
|
170
176
|
h2 = ph; dev2 = @primary[:device]
|
171
177
|
end
|
172
178
|
|
173
|
-
|
179
|
+
percent_finish = @activity.nil? ? nil : "[%3d%% %8s]" % [@percent,@finish]
|
174
180
|
|
175
|
-
"%2d %6s %-13s %
|
181
|
+
"%2d %6s %-13s %15s %-22s %-20s %10s %-11s %10s %-11s" % [@id,@name,@cstate,percent_finish,@dstate,@state,h1,dev1,h2,dev2]
|
176
182
|
end
|
177
183
|
|
178
184
|
def inspect
|
data/lib/dribbled/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dribbled
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xml-simple
|