Skip to content

Commit

Permalink
v0.5.3 - fma
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Wilhelm committed Jan 11, 2014
2 parents e93334f + 43d397e commit f446f7c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.5.3

* collectors/fma - solaris faults collector

# 0.5.2

* collectors/service - solaris (smf) implementation
Expand Down
7 changes: 7 additions & 0 deletions collectors/fma/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Description

Report solaris FMA faults. Specifically, `fmadm faulty -r`.

# Configuration

* `fmadm` — path to fmadm command (or array with arguments)
6 changes: 6 additions & 0 deletions collectors/fma/fakebin/fmadm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

echo 'fmd:///module/ses-log-transport degraded
fmd:///module/eft degraded
'
# fmd:///module/just-pretending not working'
28 changes: 28 additions & 0 deletions collectors/fma/fma
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env ruby
# Copyright (C) 2014 Cisco, Inc.

require 'json'
class Array; def to_h; Hash[self]; end; end

opt = JSON::parse(ARGV[0], {symbolize_names: true})

cmd = [opt[:fmadm] || 'fmadm'].flatten

faults = IO.popen(cmd + ['faulty', '-r']) {|fh| fh.readlines("\n") }.
map {|fault| fault.chomp.split(/\s+/, 2)}.to_h
raise "fmadm error - #{$?.exitstatus}" unless $?.success?

# SmartOS-specific bug
skip = %w(
fmd:///module/ses-log-transport
fmd:///module/eft
).map {|n| [n, true]}.to_h

faults.keys.each {|k| faults.delete(k) if skip[k]}

metrics = {
faults: faults.keys.count,
}
metrics[:_info] = faults if faults.keys.count > 0

puts JSON::generate(metrics)
2 changes: 1 addition & 1 deletion lib/panoptimon/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (C) 2012-2014 Cisco, Inc.

module Panoptimon
VERSION = "0.5.2"
VERSION = "0.5.3"
end

0 comments on commit f446f7c

Please sign in to comment.