I am attempting to check the status of tailscale on multiple servers by running “tailscale status” via an “execute:command” node per server. If the status fails on any node, I’d would like to pass on the serverName variable of the node that failed to an AI Agent for troubleshooting.
The output of multiple execute commands is passed to an If statement so that if the error code is 1 it flows onto the next node.
For testing my next node is Edit Fields where I am attempting to include the serverName variable within some text, e.g. Server name is: {{$json.serverName}}
However this doesn’t work with a generic name, it seems I need to specify a source which is not what I’d like:
Now that I have the Merge in place (just before the If node), I’ve tried Append and Combine, but the result seems to be the same either way.
What I would like to do is use {{$json.serverName}} within my AI prompt so it knows which server to query, but when I execute the flow this field always ends up being undefined, whereas the hardcoded field {{ $(‘set dsrv5’).item.json.serverName }} returns the name:
Ah, I didn’t realise how Merge worked until now. I can see that it presents the “serverName” variable within Merge itself, and that’s how I can reference {{$json.serverName}}.
I couldn’t see this before because my layout wouldn’t allow merging fields from 4 nodes back, it had to be the adjacent nodes, so I reworked my flow into the following with two If statements instead of one: