public class ActiveAgent extends ZabbixClient implements java.lang.Runnable
One of the advantages of the active check model is that it can work if the agent is behind a firewall and thus can not be reached from the outside network.
The client uses a (possibly inactive) instance of a AgentServer
to
retrieve the metric value information. The retrieving process of each metric
value is handled asynchronously using a thread pool.
Constructor and Description |
---|
ActiveAgent(AgentServer agentServer,
java.util.concurrent.ThreadPoolExecutor pool,
long refreshPeriod)
Creates the active agent instance with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.ThreadPoolExecutor |
getPool()
Returns the thread pool that is used for the asynchronous metric value
retrieval.
|
long |
getRefreshPeriod()
Returns the refresh period of the active check list.
|
void |
run()
Starts the active check loop.
|
void |
setPool(java.util.concurrent.ThreadPoolExecutor pool)
Sets the thread pool for the asynchronous metric value retrieval.
|
void |
setRefreshPeriod(long refreshPeriod)
Sets the refresh period of the active check list.
|
getAddress, getHostName, setAddress, setAddress, setAddress, setAddress, setHostName
public ActiveAgent(AgentServer agentServer, java.util.concurrent.ThreadPoolExecutor pool, long refreshPeriod)
agentServer
- the metric value retrieval servicepool
- the thread pool for asynchronous value retrievalrefreshPeriod
- the active check set refresh period in millisecondspublic void run()
refreshPeriod
parameter. All
of the active metric elements are placed in the queue in the order of
their expiration. Every time the refreshPeriod
of an entry is passed the new value for that entry is
requested asynchronously using the composed MetricRequest
task
object. The task configured in such a way that the updated entry is
placed to the ResponseQueue
table. By the placing the expiration
date of the entry is reset to a new value causing the entry to stay in
the queue up to its refreshPeriod
before its value is sent to
the server. After that the entry is placed back to the active check
list.
When the active check list itself expires the response queue process is signaled to terminate after sending the enqueued data to the server. The up to date set of active checks is requested from the server and a new delay and response queues instances are created. Thus the out of date entries in the previous response queue is not returned back to the new active check list.
run
in interface java.lang.Runnable
public void setRefreshPeriod(long refreshPeriod)
refreshPeriod
- the refresh period value in millisecondsActiveMetricTable.setRefreshPeriod(long)
public long getRefreshPeriod()
ActiveMetricTable.getRefreshPeriod()
public void setPool(java.util.concurrent.ThreadPoolExecutor pool)
pool
- the thread pool executor servicepublic java.util.concurrent.ThreadPoolExecutor getPool()