Class CountMonitor
java.lang.Object
io.appform.ranger.core.healthservice.monitor.IsolatedHealthMonitor<HealthcheckStatus>
io.appform.ranger.core.healthservice.monitor.sample.CountMonitor
- All Implemented Interfaces:
Monitor<HealthcheckStatus>,Runnable
- Direct Known Subclasses:
DiskSpaceMonitor
A monitor that can be used as a counting monitor to check if any countable entity breaches a threashhold
Eg:
1. this could be used to check the heap of your java service, if heap goes beyond a threshold,
after which, you would want your service to be marked as unhealthy
Just extend this class and implement
getCount(),
where you could connect to the MBeanServerand return the current heap space being consumed
2. this could be used to keep track of the active thread count of the service- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class io.appform.ranger.core.healthservice.monitor.IsolatedHealthMonitor
name -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCountMonitor(String name, CountMonitor.CheckSign checkSign, Integer threshold, TimeEntity timeEntity) -
Method Summary
Methods inherited from class io.appform.ranger.core.healthservice.monitor.IsolatedHealthMonitor
disable, enable, getHealthStatus, hasValidUpdatedTime, isDisabled, run
-
Constructor Details
-
CountMonitor
protected CountMonitor(String name, CountMonitor.CheckSign checkSign, Integer threshold, TimeEntity timeEntity) - Parameters:
name- name of monitorcheckSign-CountMonitor.CheckSignthreshold- threshold with which the current count will be checkedtimeEntity- how often themonitor()check needs to be executed
-
-
Method Details
-
monitor
Description copied from interface:Monitortrigger a single check of the monitor service- Returns:
- status of check
-
getCount
- Returns:
- the current value of the entity being monitored
-