我正在尝试使用Jenkins CLI检查特定的Jenkins节点是否已连接。要获取节点详细信息,我可以使用get-node
命令,它以XML格式返回详细信息
<?xml version="1.0" encoding="UTF-8"?>
<slave>
<name>20170602_jenkins_slave_002</name>
<description>10.49.82.46</description>
<remoteFS>c:\\jenkins_root</remoteFS>
<numExecutors>1</numExecutors>
<mode>EXCLUSIVE</mode>
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
<launcher class="hudson.slaves.JNLPLauncher"/>
<label>20170602_jenkins_slave_002</label>
<nodeProperties/>
<userId>admin</userId>
</slave>
但是它不包括节点状态。任何人都知道如何通过Jenkins cli检查节点状态
由于我不知道使用jenkins-cli的方法,我的建议是使用REST API:
http://jenkins.example.com/computer/:name/api/json
返回包含offline
字段的JSON数据。
您可以在以下URL上概述所有代理(在此称为计算机):
http://jenkins.example.com/computer/api/json?pretty=true
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句