Ad Widget

Collapse

Zabbix Get item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • messah
    Junior Member
    • Feb 2013
    • 3

    #1

    Zabbix Get item

    Hi;

    I use https://github.com/gescheit/scripts/tree/master/zabbix script. I try to just connect and get item from monitor but I dont do that. I use Zabbix 1.8.11 version.


    Code:
    from zabbix_api import ZabbixAPI
    
    server="http://127.0.0.1"
    username="api"
    password="apipass"
    
    zapi = ZabbixAPI(server=server, path="", log_level=6)
    zapi.login(username, password)
    
    host_name="test_host"
    
    description='Used disk space on $1 in %' 
    key='vfs.fs.size[/,pused]'
    
    hostid=zapi.host.get({"filter":{"host":host_name}})[0]["hostid"]
    print hostid
    I get that:

    Code:
    raise ZabbixAPIException(msg, jobj['error']['code'])
    zabbix_api.ZabbixAPIException: (u'Error -32602: Invalid params., No API access while sending {"params": {"filter": {"host": "hostname"}}, "jsonrpc": "2.0", "method": "host.get", "auth": "67a5cb34js6le8e3484ecc70bfe66108", "id": 1}', -32602)
    I think I enter coorect information. How I do that ?
  • heaje
    Senior Member
    Zabbix Certified Specialist
    • Sep 2009
    • 325

    #2
    with zabbix 1.8.x you must enable API access for users. Make sure your user has API access by going to the user administration page in the web GUI.

    Comment

    • messah
      Junior Member
      • Feb 2013
      • 3

      #3
      Thank you heaje. its work.

      Administator >> Users >> API access

      Add members who connect to zabbix and change Apı access section. Disabled --> Enabled

      thats all

      Comment

      Working...