如何使用jenkins-cli检查jenkins节点连接状态 [英] How to check jenkins node connection status using jenkins-cli

查看:396
本文介绍了如何使用jenkins-cli检查jenkins节点连接状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Jenkins CLI .要获取节点详细信息,我可以使用get-node命令,它以xml格式返回详细信息

I'm trying to check specific Jenkins node is connected using Jenkins CLI . To get the node details I can use get-node command and it returns details as this 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

But it does not includes the node status. Anyone has idea how to check the node status by Jenkins cli

推荐答案

由于我不知道使用,我的建议是使用REST API:

As I'm not aware of a method using jenkins-cli, my suggestion is to use the REST API:

http://jenkins.example.com/computer/:name/api/json

返回包含offline字段的JSON数据.

returns JSON data including an offline field.

您可以在以下URL上获得所有代理(此处称为计算机)的概述:

You can get an overview over all agents (called computer here) on the following URL:

http://jenkins.example.com/computer/api/json?pretty=true

这篇关于如何使用jenkins-cli检查jenkins节点连接状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆