New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

populate_hostid_cache mixes up host's name and visible name #35

Closed
blu3bird opened this Issue Mar 20, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@blu3bird

blu3bird commented Mar 20, 2017

populate_hostid_cache uses the visible name of the host while everything else uses the real name.
It should also not exclude not monitored(disabled) host, otherwise define_host_monitoring_status is useless in bulk operations.

Here's my quick and dirty fix which seems to work just fine:

index fd32527..0fa9976 100644
--- a/zabbix_cli/cli.py
+++ b/zabbix_cli/cli.py
@@ -7672,11 +7672,10 @@ class zabbixcli(cmd.Cmd):
         try:
             temp_dict = {}
             
-            data = self.zapi.host.get(output=['hostid','name'],
-                                      monitored_hosts=True)
+            data = self.zapi.host.get(output=['hostid','host'])
 
             for host in data:
-                temp_dict[host['hostid']] = host['name'] 
+                temp_dict[host['hostid']] = host['host'] 
 
             return temp_dict
          ```
@ghost

This comment has been minimized.

Collaborator

ghost commented Mar 21, 2017

Thanks for the feedback.
+1. This is a confirmed bug and will be fixed with the next release.

The problem is the monitored_hosts=True attribute. name == host if it is not defined according to the API doc: https://www.zabbix.com/documentation/3.0/manual/api/reference/host/object#host

@usit-gd usit-gd added the bug label Mar 21, 2017

@usit-gd usit-gd added this to the 1.7.0 milestone Mar 21, 2017

rafaelma added a commit that referenced this issue Mar 21, 2017

populate_hostid_cache() has to include all host defined in zabbix, no…
…t only the enable ones. Fix attribute name->host for consistency. [Issue:#35]

@usit-gd usit-gd closed this Mar 21, 2017

@ghost ghost assigned rafaelma Mar 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment