How do I get the server's label name from within the server?
I need to get the label name of the server in the StackScript, how do I do this?
4 Replies
✓ Best Answer
There's a Linode API call to do this:
https://techdocs.akamai.com/linode-api/reference/api-summary#linodes-list
What you're looking for is the "label"
-- sw
P.S. If you put the Linode ID from the cloud manager into a file on your Linode (say /etc/linodeid), your query can read that file and just query that Linode…instead of having to sort through all the Linodes assigned to you (which is what the above returns to you). The Linode ID is a constant for the life of the Linode.
Ah so the label is not put anywhere don't the server, it has to be queried through the API.
The label is a construct of the Linode platform…not the VPS or the distro. You only have access to it using the facilities of the Linode platform (the API).
-- sw
Hello,
StackScripts do set a few environment variables, including LINODE_ID - but not label. But LINODE_ID may help you…
-Chris