bin/keystone/keystone-token-metrics.rb in sensu-plugins-openstack-0.0.3 vs bin/keystone/keystone-token-metrics.rb in sensu-plugins-openstack-0.0.4
- old
+ new
@@ -77,16 +77,16 @@
config[:by_user] = true
where = "WHERE user.name IN ('#{config[:ks_users].gsub(/,/, "', '")}')"
end
metrics = %w(active expired total)
sql = <<-eosql
-SELECT #{ 'user.name,' if config[:by_user] }
+SELECT #{'user.name,' if config[:by_user]}
SUM(IF(NOW() <= expires,1,0)) AS active,
SUM(IF(NOW() > expires,1,0)) AS expired,
COUNT(*) AS total FROM token
eosql
sql.concat <<-eosql if config[:by_user]
-LEFT JOIN user ON token.user_id = user.id #{ where }
+LEFT JOIN user ON token.user_id = user.id #{where}
GROUP BY user.name
eosql
begin
mysql = Mysql2::Client.new(
host: config[:host], port: config[:port],