lib/zabbix-ruby-client/plugins/mysqlcommand.rb in zabbix-ruby-client-0.1.2 vs lib/zabbix-ruby-client/plugins/mysqlcommand.rb in zabbix-ruby-client-0.1.3
- old
+ new
@@ -2,19 +2,19 @@
module ZabbixRubyClient
module Plugins
module Mysqlcommand
extend self
+ extend ZabbixRubyClient::PluginBase
def collect(*args)
host = args.shift
app = args.shift
mysqldb = args.shift
mysqlargs = args.shift
mysqlcommand = "mysql #{mysqlargs} -s --skip-column-names -e \"%s\" #{mysqldb}"
back = []
Hash[*args].each do |name, command|
- time = Time.now.to_i
comm = sprintf(mysqlcommand, command.gsub(/"/,'\"'))
res = `#{comm}`
if $?.to_i == 0
if name[0] == "_"
res.each_line do |line|