Class AbstractNodeMonitorDescriptor<T>

  • Type Parameters:
    T - represents the result of the monitoring.
    All Implemented Interfaces:
    Saveable, Loadable, OnMaster
    Direct Known Subclasses:

    public abstract class AbstractNodeMonitorDescriptor<T>
    extends Descriptor<NodeMonitor>
    Convenient base class for common NodeMonitor implementation where the "monitoring" consists of executing something periodically on every node and taking some action based on its result.
    Kohsuke Kawaguchi
    • Method Detail

      • canTakeOffline

        public boolean canTakeOffline()
        Indicates if this monitor is capable to take agents offline in case it detects a problem. If true, this will enable the configuration option to ignore the monitor. Defaults to true so plugins that do not override this method behave as before. Plugins that do implement a monitor that will not take agents offline should override this method and return false.
        true if this monitor might take agents offline
      • monitor

        protected abstract T monitor​(Computer c)
                              throws IOException,
        Performs monitoring of the given computer object. This method is invoked periodically to perform the monitoring of the computer.
        Application-specific value that represents the observed monitoring value on the given node. This value will be returned from the get(Computer) method. If null is returned, it will be interpreted as "no observed value." This is convenient way of abandoning the observation on a particular computer, whereas IOException is useful for indicating a hard error that needs to be corrected.
      • get

        public T get​(Computer c)
        Obtains the monitoring result currently available, or null if no data is available.

        If no data is available, a background task to collect data will be started.

      • getTimestamp

        public long getTimestamp()
        The timestamp that indicates when the last round of the monitoring has completed.
      • getTimestampString

        public String getTimestampString()
      • isIgnored

        public boolean isIgnored()
        Is this monitor currently ignored?
      • markOnline

        protected boolean markOnline​(Computer c)
        Utility method to mark the computer online for derived classes.
        true if the node was actually taken online by this act (as opposed to us deciding not to do it, or the computer was already online.)
      • markOffline

        protected boolean markOffline​(Computer c,
                                      OfflineCause oc)
        Utility method to mark the computer offline for derived classes.
        true if the node was actually taken offline by this act (as opposed to us deciding not to do it, or the computer already marked offline.)
      • getMonitoringTimeOut

        protected long getMonitoringTimeOut()
        Controls the time out of monitoring.