Add some compatibility for older MySQL servers

tags/zabbix-agent-addons-0.2.126-1
Daniel Berteaud 4 years ago
parent 31c859df0c
commit 6467da92c4
  1. 8
      zabbix_scripts/check_mysql_sudo

@ -88,6 +88,14 @@ if ($exit eq 0){
my ($key, $val) = split(/\t/, $_); my ($key, $val) = split(/\t/, $_);
$json->{$key} = $val; $json->{$key} = $val;
} }
# Some older MySQL do not have all the variables we might want
if (not defined $json->{Acl_users}){
$json->{Acl_users} = qx(mysql $opt --batch --skip-column-names --execute 'select count(user) from user;' mysql);
chomp $json->{Acl_users};
}
if (not defined $json->{Max_statement_time_exceeded} and defined $json->{Max_execution_time_exceeded}){
$json->{Max_statement_time_exceeded} = $json->{Max_execution_time_exceeded}
}
} }
} }

Loading…
Cancel
Save