Enhancement #24375
closed[feature request] Allow API for 'GET information about a node' to use hostname as well as UUID
Description
Greetings,
I found a slightly related request, but about compliance API - https://issues.rudder.io/issues/9122
The API endpoint: https://docs.rudder.io/api/v/18/#tag/Nodes/operation/nodeDetails
only takes a UUID, or 'root'.
I appreciate I can reduce the total payload by including only 'id, hostname, status', but I'm evaluating usage as an CMDB for a large-ish fleet, and having to pull down and search through a large json payload is not ideal when I know the hostname I need to lookup.
Updated by François ARMAND about 2 months ago
- Tracker changed from Bug to Enhancement
- Priority deleted (
0)
Hello,
You can use a search pattern for that (which is a bit awful to be gentle with us, but on the other hand you can get it from the group page URL)
For ex:
curl --globoff -k -X GET -H "X-API-TOKEN: XXXX" 'https://myserver/rudder/api/latest/nodes?where=[{"objectType":"node","attribute":"nodeHostname","comparator":"regex","value":"node.*"}]&include=minimal' | jq -r '.'
Will return all nodes hostname matching node.*
pattern.
You can of course math on "eq", or for list of exact hostnames, you can use the java-flavor regex for alternative:
curl --globoff -k -X GET -H "X-API-TOKEN: XXXX" 'https://myserver/rudder/api/latest/nodes?where=[{"objectType":"node","attribute":"nodeHostname","comparator":"regex","value":"node1.rudder.local|node2.rudder.local"}]&include=minimal' | jq -r '.'
Does it helps ?
Updated by Jedd Rashbrooke about 1 month ago
Apologies for very slow response.
Yes, this works really well. It was a bit slow to run that query the first, but I think that's just my lab environment being under-resourced. A second call to the group API was very fast. I'll be experimenting with loading up ~ 10,000 nodes (not agent-registered) soon, and will get a better feel for performance there, but I'm optimistic this'll work well.
Thank you again.
Updated by François ARMAND 3 days ago
For the latency on first try: rudder being on the JVM, some path need to be warm-up a bit to let the jvm knows that you expect them to be quick. 10k nodes is OK (we have customers with that range), but it might be a bit challanging. Does hesitate to ask if you encounter specific problems regarding that.
Updated by François ARMAND 3 days ago
(you can ask on chat.rudder.io for more interactive questions/answers sessions)
Updated by Nicolas CHARLES 3 days ago
Hi Jedd,
To extend a bit on François's answer, we do have an internal test platform with 10k nodes - most aspect of Rudder are tested, including the API on this platform
The API does respond well and in a quickly with 10k (but may need a bit of memory) as long as you don't include softwares and processes in the output, as they tend to generate really large output (and can lead to OOM)