how to set agent node status as 'offline' on jenkin controller if agent machine is shutdown?

101 Views Asked by At

I have 2 agent nodes & I can start the job on agent node from jenkins master(agent is used). whereas my agent machines are shutdown/offline due to any hardware failure reason still I can execute job on that agent node from jenkin controller & then I get in response the node is not responding while executing a job.

I want a real time online/offline status of agent node before assigning them a job from jenkins controller. As currently I am assigning a job and letter come to know that slave is not responding.

NOTE:- This issue only came if controller & agent nodes are on different machine

Is there any step which I missed while setting up an agent node which can resolve my issue? or is there any way by which we can monitor slave machine status i.e. online/offline before assigning them any job by using some mechanism like ping command after every 5 mins , or something similar to this?

below .bat file I am using to start the slave node

:START_JENKINS_CLIENT
%JAVA_HOME%\bin\java -Djavax.net.ssl.trustStore=C:\Users\abc\tls\cacerts -Djavax.net.ssl.trustStorePassword=changeit -jar C:\Users\parakhdh\jenkins-tools\agent.jar -jnlpUrl %JENKINS_SERVER_URI%/jenkins/computer/%JENKINS_NODE%/slave-agent.jnlp -secret TEST_SECRET_KEY
goto START_JENKINS_CLIENT

What should I add so that before starting this agent it will check wether slave machine is up & running or offline due to hardware any failure.

0

There are 0 best solutions below