Ad Widget

Collapse

Unexpected connection error when host.get() with search

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmao
    Junior Member
    • Jun 2013
    • 1

    #1

    Unexpected connection error when host.get() with search

    I have a python script to find out get all hosts managed under Zabbix.

    method = 'host.get'
    params = { "output" : "extend", }
    params['search'] = { "host" : '*' }
    params['searchWildcardsEnabled'] = 1
    params['limit'] = 5000
    error, response = request(method, params)
    pprint.pprint(len(response['result'][0]))

    Everything else works with the API but when I try to search all, I see zabbix returns 31 hosts and failed to connect again. Any suggestions or an easier way to get all hosts managed by Zabbix? Thank you.

    31
    {u'available': u'2',
    u'disable_until': u'1372082270',
    u'error': u'Get value from agent failed: cannot connect to [[zabbix.local]:10050]: [111] Connection refused',
    u'errors_from': u'1372075070',
    u'host': u'zabbix.local',
    u'hostid': u'100100000010084',
    u'ipmi_authtype': u'-1',
    u'ipmi_available': u'0',
    u'ipmi_disable_until': u'0',
    u'ipmi_error': u'',
    u'ipmi_errors_from': u'0',
    u'ipmi_password': u'',
    u'ipmi_privilege': u'2',
    u'ipmi_username': u'',
    u'jmx_available': u'0',
    u'jmx_disable_until': u'0',
    u'jmx_error': u'',
    u'jmx_errors_from': u'0',
    u'lastaccess': u'0',
    u'maintenance_from': u'0',
    u'maintenance_status': u'0',
    u'maintenance_type': u'0',
    u'maintenanceid': u'0',
    u'maintenances': [],
    u'name': u'zabbix.local',
    u'proxy_hostid': u'0',
    u'snmp_available': u'0',
    u'snmp_disable_until': u'0',
    u'snmp_error': u'',
    u'snmp_errors_from': u'0',
    u'status': u'0'}
Working...