本文整理汇总了Java中com.quigley.zabbixj.agent.ZabbixAgent类的典型用法代码示例。如果您正苦于以下问题:Java ZabbixAgent类的具体用法?Java ZabbixAgent怎么用?Java ZabbixAgent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ZabbixAgent类属于com.quigley.zabbixj.agent包,在下文中一共展示了ZabbixAgent类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupAgent
import com.quigley.zabbixj.agent.ZabbixAgent; //导入依赖的package包/类
/**
* Sets up the Zabbix Agent with the current configuration.
*/
private static void setupAgent()
{
if (!MonitorFactory.blnIsStarted)
{
try
{
MonitorFactory.objAgent = new ZabbixAgent();
MonitorFactory.objAgent.setEnableActive(true);
MonitorFactory.objAgent.setEnablePassive(false);
MonitorFactory.objAgent.setHostName(MonitorFactory.getHostname());
MonitorFactory.objAgent.setServerAddress(InetAddress.getByName(MonitorFactory.getServerAddress()));
MonitorFactory.objAgent.setServerPort(MonitorFactory.getServerPort());
MonitorFactory.objAgent.addProvider("monitor", new DiscoverProvider());
MonitorFactory.objAgent.addProvider("messenger", new MessengerProvider());
}
catch (Exception e)
{
MonitorFactory.objMonitor.error(MonitorFactory.class,
"Failed to initiate the Zabbix Agent. No active/passive communication with the server available, ALL monitoring dropped.");
}
}
}
示例2: main
import com.quigley.zabbixj.agent.ZabbixAgent; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
if(args.length < 3) {
System.out.println("Usage: ExampleActiveAgent <hostName> <serverAddress> <serverPort>");
return;
}
String hostName = args[0];
String serverAddress = args[1];
int serverPort = Integer.parseInt(args[2]);
ZabbixAgent agent = new ZabbixAgent();
agent.setEnableActive(true);
agent.setEnablePassive(false);
agent.setHostName(hostName);
agent.setServerAddress(InetAddress.getByName(serverAddress));
agent.setServerPort(serverPort);
agent.addProvider("example", new ExampleMetricsProvider());
agent.addProvider("java", new JVMMetricsProvider());
agent.start();
while(true) {
Thread.sleep(10000);
}
}
示例3: main
import com.quigley.zabbixj.agent.ZabbixAgent; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
if(args.length < 1) {
System.out.println("Usage: ExamplePassiveAgent <listenPort>");
return;
}
int listenPort = Integer.parseInt(args[0]);
ZabbixAgent agent = new ZabbixAgent();
agent.setListenPort(listenPort);
agent.addProvider("example", new ExampleMetricsProvider());
agent.addProvider("java", new JVMMetricsProvider());
agent.start();
while(true) {
Thread.sleep(10000);
}
}