SNMP Data in a plugin not being sent to Graphite

I have a new installation of Sensu with Graphite all running on an Ubuntu 14 server. If I run the vmstat-metrics.rb process, the data is posted to graphite. If I run any snmp related plugin (snmp-if-metrics.rb for example), the data does not make it to graphite. If I perform the check from command-line (ruby /etc/sensu/plugins/snmp-if-metrics.rb -C domain.com -h 10.1.1.1 --include-name -s router.teksincdc | nc 127.0.0.1 2003) the data gets posted to graphite.

Here is the code:

snmp-if-metrics.json

{

“checks”: {

"snmp-if-metrics-linux": {

  "handlers": ["graphite_line_tcp"],

  "command": "/etc/sensu/plugins/snmp-if-metrics.rb -C domain.com -h 10.1.1.1 --include-name -s router.location --low-capacity",

  "interval": 60,

  "subscribers": [ "linux" ]

}

}

}

built-in-relay.json

{

“handlers”: {

"graphite_line_tcp": {

  "type": "tcp",

  "socket": {

    "host": "127.0.0.1",

    "port": 2003

  },

  "mutator": "graphite"

}

}

}

I have tried a multitude of mutators and none seem to be making any difference. Here is the one I am currently using.

graphite_mutator.json

{

“mutators”: {

"graphite": {

  "command": "/etc/sensu/mutators/graphite.rb"

}

}

}

/etc/sensu/mutators/graphite.rb

parse event

event = JSON.parse(STDIN.read, symbolize_names: true)

if ARGV[0] == ‘-r’ || ARGV[0] == ‘–reverse’

puts event[:check][:output].gsub(event[:client][:name], event[:client][:name].split(’.’).reverse.join(’.’))

else

puts event[:check][:output].gsub(event[:client][:name], event[:client][:name].gsub(’.’, ‘_’))

end

There are no errors in the log files that I have not resolved. Any help would be appreciated. This is driving me nuts. I have built and rebuilt thinking I did something wrong.

Check definition needs “type”: “metric”. I do not recommend using a standard mutator for metric collection/delivery, better to produce the desired graphite plain text output with the check plugin. The “only_check_output” mutator is built in, running within the Sensu Ruby VM.

Sean.

···

On Apr 2, 2015 11:39 AM, “David Kaminsky” dkamin5713@gmail.com wrote:

I have a new installation of Sensu with Graphite all running on an Ubuntu 14 server. If I run the vmstat-metrics.rb process, the data is posted to graphite. If I run any snmp related plugin (snmp-if-metrics.rb for example), the data does not make it to graphite. If I perform the check from command-line (ruby /etc/sensu/plugins/snmp-if-metrics.rb -C domain.com -h 10.1.1.1 --include-name -s router.teksincdc | nc 127.0.0.1 2003) the data gets posted to graphite.

Here is the code:

snmp-if-metrics.json

{

“checks”: {

"snmp-if-metrics-linux": {
  "handlers": ["graphite_line_tcp"],
  "command": "/etc/sensu/plugins/snmp-if-metrics.rb -C [domain.com](http://domain.com) -h 10.1.1.1 --include-name -s router.location --low-capacity",
  "interval": 60,
  "subscribers": [ "linux" ]
}

}

}

built-in-relay.json

{

“handlers”: {

"graphite_line_tcp": {
  "type": "tcp",
  "socket": {
    "host": "127.0.0.1",
    "port": 2003
  },
  "mutator": "graphite"
}

}

}

I have tried a multitude of mutators and none seem to be making any difference. Here is the one I am currently using.

graphite_mutator.json

{

“mutators”: {

"graphite": {
  "command": "/etc/sensu/mutators/graphite.rb"
}

}

}

/etc/sensu/mutators/graphite.rb

parse event

event = JSON.parse(STDIN.read, symbolize_names: true)

if ARGV[0] == ‘-r’ || ARGV[0] == ‘–reverse’

puts event[:check][:output].gsub(event[:client][:name], event[:client][:name].split(‘.’).reverse.join(‘.’))

else

puts event[:check][:output].gsub(event[:client][:name], event[:client][:name].gsub(‘.’, ‘_’))

end

There are no errors in the log files that I have not resolved. Any help would be appreciated. This is driving me nuts. I have built and rebuilt thinking I did something wrong.