Skip to content

Instantly share code, notes, and snippets.

@crazyboycjr
Created August 7, 2019 05:10
Show Gist options
  • Save crazyboycjr/02a05f941445ee13343b353108ececea to your computer and use it in GitHub Desktop.
Save crazyboycjr/02a05f941445ee13343b353108ececea to your computer and use it in GitHub Desktop.
demonstrate how to execute on mellanox os remotely
#!/bin/bash
read -r -d '' data << EOF
{
"execution_type": "sync",
"commands": [
"show lldp remote",
"show running-config"
]
}
EOF
echo "$data"
# get login session
curl -X POST -c /tmp/cookie -d 'f_user_id=xmladmin&f_password=xmladmin' 'http://mellanox.maas/admin/launch?script=rh&template=login&action=login' 2>&1 >/dev/null
# post real request
curl -X POST -b /tmp/cookie -d "$data" 'http://mellanox.maas/admin/launch?script=json'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment