Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Refer to https://github.com/zembutsu/zabbix-api-tools/blob/master/auth.sh
- ## Usage ./zab.sh json_file
- json='{"jsonrpc":"2.0","method":"user.login","params":{"user":"Admin","password":"zabbix"},"id":1}'
- authid=$(curl -s -XGET -H"Content-Type:application/json-rpc" -d$json http://10.0.3.10/zabbix/api_jsonrpc.php | jq -r '.result')
- json=$(cat $1 | jq -r "." -c | sed -e s/AUTH_ID/$authid/g)
- echo $json
- curl -s -XGET -H"Content-Type:application/json-rpc" -d$json http://10.0.3.10/zabbix/api_jsonrpc.php | jq -r '.result'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement