tvogl
(ToddVogl)
August 15, 2022, 7:24pm
1
As part of an Ansible automation to update Jenkins Node Docker Containers… we validate if a Jenkins node is currently being used by using the following command:
curl -X POST -L --user useraccount:‘apitoken’ “https://jenkins.domain.com:8443/computer/agent-1/api/json?pretty=true ” -k | grep “idle”
“idle” : true,
When idle true comes back we know we can take the node offline without affecting any running jobs.
We just migrated to Java 11 and Jenkins 2.357 on a server. Now there is no idle status using that command.
Is there another way to monitor if node is being used to get active/idle status?
mawinter69
(Markus Winter)
August 15, 2022, 7:47pm
2
Just tested on the source code state from yesterday and ‘idle’ is still in there.
tvogl
(ToddVogl)
August 15, 2022, 8:11pm
3
the command still works with Jenkins 2.349 and Java 8.
This is the start of the data I get back when running that command on the Jenkins 2.357 Java 11 server/node:
Does this help identify what I’m getting back?
<title>Jenkins [Jenkins]</title><link rel="stylesheet" href="/static/8e0e9f61/jsbundles/styles.css" type="text/css"></link><link rel="stylesheet" href="/static/8e0e9f61/css/responsive-grid.css" type="text/css"></link><link rel="shortcut icon" href="/static/8e0e9f61/favicon.ico" type="image/vnd.microsoft.icon"></link><script src="/static/8e0e9f61/scripts/prototype.js" type="text/javascript"></script><script src="/static/8e0e9f61/scripts/behavior.js" type="text/javascript"></script><script src='/adjuncts/8e0e9f61/org/kohsuke/stapler/bind.js' type='text/javascript'></script><script src="/static/8e0e9f61/scripts/yui/yahoo/yahoo-min.js"></script><script src="/static/8e0e9f61/scripts/yui/dom/dom-min.js"></script><script src="/static/8e0e9f61/scripts/yui/event/event-min.js"></script><script src="/static/8e0e9f61/scripts/yui/animation/animation-min.js"></script><script src="/static/8e0e9f61/scripts/yui/dragdrop/dragdrop-min.js"></script><script src="/static/8e0e9f61/scripts/yui/container/container-min.js"></script><script src="/static/8e0e9f61/scripts/yui/connection/connection-min.js"></script><script src="/static/8e0e9f61/scripts/yui/datasource/datasource-min.js"></script><script src="/static/8e0e9f61/scripts/yui/autocomplete/autocomplete-min.js"></script><script src="/static/8e0e9f61/scripts/yui/menu/menu-min.js"></script><script src="/static/8e0e9f61/scripts/yui/element/element-min.js"></script><script src="/static/8e0e9f61/scripts/yui/button/button-min.js"></script><script src="/static/8e0e9f61/scripts/yui/storage/storage-min.js"></script><script src="/static/8e0e9f61/scripts/hudson-behavior.js" type="text/javascript"></script><script src="/static/8e0e9f61/scripts/sortable.js" type="text/javascript"></script><link rel="stylesheet" href="/static/8e0e9f61/scripts/yui/container/assets/container.css" type="text/css"></link><link rel="stylesheet" href="/static/8e0e9f61/scripts/yui/container/assets/skins/sam/container.css" type="text/css"></link><link rel="stylesheet" href="/static/8e0e9f61/scripts/yui/menu/assets/skins/sam/menu.css" type="text/css"></link><link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Jenkins"></link><meta name="ROBOTS" content="INDEX,NOFOLLOW"></meta><meta name="viewport" content="width=device-width, initial-scale=1"></meta><script src="/adjuncts/8e0e9f61/org/kohsuke/stapler/jquery/jquery.full.js" type="text/javascript"></script><script>var Q=jQuery.noConflict()</script><script>
if(window.Prototype && JSON) {
var _json_stringify = JSON.stringify;
JSON.stringify = function(value) {
var _array_tojson = Array.prototype.toJSON;
delete Array.prototype.toJSON;
var r=_json_stringify(value);
Array.prototype.toJSON = _array_tojson;
return r;
};
}
<script src="
halkeye
(Gavin Mogan)
August 15, 2022, 10:36pm
4
thats an html page. You could pipe it through w3m to see what it renders as, but look for like
or
tags
Also if you havn’t looked at it, for handling json, jq > grep. It would tell you that the results are not json and stuff.
tvogl
(ToddVogl)
November 11, 2022, 2:03pm
5
This seems to be working again.