MySQL PI database agent fails to connect to MariaDB database and fails to collect data.
"Communication Link Failures" in the database agent log.
Using the Script Console, run the following script to Enable or Disable the use of the MariaDB driver to connect to MariaDB database.
Include the MySQL (MariaDB) agent name between the quotes following the AGENTNAME variable.
Set the value in line 6 to "1" to enable the MariaDB driver for the agent.
configService = server.get("ConfigService");
agentService = server.get("AgentService");
def modifyAgentPropertiesPrimary(agent) {
def primary = configService.getAgentInstancePrimaryAsp("DB_MySQL_PI", "DB_MySQL_PI", agent.getId());
primary.setValueByString("MariaDBDriver", "0");
configService.saveConfig(primary);
}
def getAgentByName(agent_name) {
agents = agentService.findByName(agent_name);
if ((agents != null) && (agents.size() > 0)) {
return agents.get(0);
} else {
return null;
}
}
AGENTNAME = "MySQLPI@HOSTNAME_3306";
agent = getAgentByName(AGENTNAME);
buff = new StringBuffer();
if (agent != null){
modifyAgentPropertiesPrimary(agent);
buff.append( "Agent '" + AGENTNAME + "' has been changed to use MariaDB driver; \n" );
} else {
buff.append( "Agent '" + AGENTNAME + "' not found ; \n" );
}
return buff.toString();
The following script lists the current values of the "Use Alternate MariaDB JDBC Driver" hidden Agent Status Property value for all MySQL PI agents.
"1" is True, in which the MariaDB driver is enabled for the agent
"0" is False, in which the MySQL driver is being used by the agent
def out = new StringBuilder();
def agentService = server.get("AgentService"); def configService = server.get("ConfigService");
def agents = agentService.findByAdapterAndType("FglAM", "DB_MySQL_PI");
for (agent in agents) {
def primaryASP = configService.getAgentInstancePrimaryAsp(agent.getAgentNamespace(), agent.getTypeId(), agent.getId());
if (primaryASP) {
out.append(String.format("%s: Use Alternate MariaDB JDBC Driver=%s\n", agent.getName(), primaryASP.getString("MariaDBDriver")));
}
}
return out.toString();