@Override
public boolean enable()
{
if (!isClassAvailable(SENDER_CLASS))
{
log.error("Tried to enable Zabbix Reporter, but class {} was not found", SENDER_CLASS);
return false;
}
if (hostName == null)
hostName = System.getenv("COMPUTERNAME");
if (hostName == null)
hostName = System.getenv("HOSTNAME");
if (hostName == null)
hostName = "localhost";
for (HostPort hostPort : getFullHostList())
{
ZabbixSender sender = new ZabbixSender(hostPort.getHost(), hostPort.getPort(), connectTimeout, socketTimeout);
ZabbixReporter reporter = new ZabbixReporter(sender, hostName, prefix, name, getRealRateunit(), getRealDurationunit(),
MetricPredicateTransformer.generatePredicate(getPredicate()), Clock.defaultClock());
reporter.start(getPeriod(), getRealTimeunit());
}
return true;
}