Paste P7881

Netbox extract serial and asset tag
ActivePublic

Authored by Volans on Mon, Dec 3, 11:56 PM.
#!/bin/bash
TOKEN=""
if [[ -z "${1}" ]]; then
echo "Usage: ${0} SERVER_NAME"
exit 1
fi
NAME="${1}"
curl -sH "Authorization: Token ${TOKEN}" -H "Accept: application/json;" https://netbox.wikimedia.org/api/dcim/devices/?name=${NAME} | jq '.results[] | .name + " | " + .serial + " | " + .asset_tag'
Volans created this paste.Mon, Dec 3, 11:56 PM