Jenkins : Display monitors status

Jenkins uses monitors to validate various behaviors. If you dismiss one, Jenkins will never propose you to reactivate it. This script allows you to check the status of all monitors and to reactive them.

About Monitors

A monitor is activated if it has detected something, so it would show on the /manage page, unless it is not enabled.

hudson.model.Hudson.instance.administrativeMonitors.each{
    println "* Monitor : "+it.id
    println "** Enabled : "+it.enabled
    println "** Activated : "+it.activated
    println "========="
}

It gives a result like that :

* Monitor : hudsonHomeIsFull
** Enabled : true
** Activated : false
=========
* Monitor : OldData
** Enabled : true
** Activated : false
=========
* Monitor : hudson.triggers.SCMTrigger$AdministrativeMonitorImpl
** Enabled : true
** Activated : false
=========
* Monitor : hudson.node_monitors.MonitorMarkedNodeOffline
** Enabled : true
** Activated : false
=========
* Monitor : hudson.diagnosis.ReverseProxySetupMonitor
** Enabled : true
** Activated : true
=========
* Monitor : hudson.diagnosis.TooManyJobsButNoView
** Enabled : true
** Activated : false
=========
* Monitor : hudson.model.UpdateCenter$CoreUpdateMonitor
** Enabled : true
** Activated : false
=========
* Monitor : hudson.plugins.scis_ad.ScisSupportOffer
** Enabled : true
** Activated : false
=========

If one monitor is disabled and you want to enable it just launch this command :

hudson.model.Hudson.instance.getAdministrativeMonitor('OldData').disable(false)

'OldData' is the monitor name returned in the list.