Ad Widget

Collapse

Can't connect to Zabbix API using Phyton

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EdwardK
    Junior Member
    • Nov 2016
    • 18

    #1

    Can't connect to Zabbix API using Phyton

    Hey!

    I'm trying to connect to Zabbix using phyton :

    Code:
    from pyzabbix import ZabbixAPI
    
    zapi = ZabbixAPI("http://****.****.***/api_jsonrpc.php")
    zapi.login("******", "*****")
    print("Connected to Zabbix API Version %s" % zapi.api_version())
    
    for h in zapi.host.get(output="extend"):
        print(h['hostid'])
    Getting this in console :

    Code:
    pyzabbix.api.ZabbixAPIException: ("Error -32602: Invalid params., Login name or password is incorrect. while sending {'jsonrpc': '2.0', 'id': '1', 'params': {'password': 'zabbix', 'user': 'admin'}, 'method': 'user.login'}", -32602)
    I'm 100% sure that username and password are correct,but can't figure why i keep getting this error.It looks like it always puts 'zabbix' and 'admin' as parameters.

    Thanks.
  • jan.garaj
    Senior Member
    Zabbix Certified Specialist
    • Jan 2010
    • 506

    #2
    Default Zabbix admin user is Admin, not admin.
    Devops Monitoring Expert advice: Dockerize/automate/monitor all the things.
    My DevOps stack: Docker / Kubernetes / Mesos / ECS / Terraform / Elasticsearch / Zabbix / Grafana / Puppet / Ansible / Vagrant

    Comment

    Working...