Forked from jsidhu/gist:766e4e85193f89c94640495959eb5620
Last active
May 5, 2024 16:43
-
-
Save isaqueprofeta/6b05b4282695086d87a9b2c0f349d9e2 to your computer and use it in GitHub Desktop.
Curl post to zabbix api (api_jsonrpc.php)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#LOGIN | |
curl -i -X POST -H 'Content-type:application/json' -d '{"jsonrpc":"2.0","method":"user.login","params":{ "user":"myUserName","password":"myPassword"},"auth":null,"id":0}' https://zabbix.server/api_jsonrpc.php | |
#GET ALL HOSTS WITH NAME | |
curl -i -X POST -H 'Content-type:application/json' -d '{"jsonrpc":"2.0","method":"host.get","params":{"output": ["hostid", "name"]},"auth":"<AUTH_KEY>","id":0}' https://zabbix.server/api_jsonrpc.php | |
#GET ALL HOSTS WITH NAME, HOSTNAME AND IP ADDRESS | |
curl -i -X POST -H 'Content-type:application/json' -d '{"jsonrpc":"2.0","method":"host.get","params":{"output":["hostid", "host", "name"], "selectInterfaces":["ip"]},"auth":"<AUTH_KEY>","id":0}' https://zabbix.server/api_jsonrpc.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it uses username now