Jenkins uptime - how much time has passed since the last restart

Can I see how long the jenkins instance / wizard lasts? I tried looking back at Jenkins Management, but the good one find him anyway. Yes, I can log in and check the process on the machine, but can this be done in jenkins web-ui?

Below the url, I can see the white line when it was restarted ... but not so intuitive.

<jenkins-url>/monitoring?part=graph&graph=usedMemory&period=mois 
+5
source share
1 answer

You can run the groovy script on the Jenkins web-ui: Manage the Jenkins console> script and use the Jenkins API. If you want to know how many days Jenkins works:

 import java.util.concurrent.TimeUnit long lastRestarted = Jenkins.instance.toComputer().getConnectTime() long now = System.currentTimeMillis() println TimeUnit.MILLISECONDS.toDays(now - lastRestarted) 

getConnectTime() of the host should have a restart time. http://javadoc.jenkins.io/hudson/model/Computer.html#getConnectTime ()

+8
source

Source: https://habr.com/ru/post/1258603/


All Articles