dav3860 / vmbix

Fork of vmbix, a TCP proxy for querying a VMWare infrastucture with Zabbix
53 stars 19 forks source link

UUID vs Names, again #3

Closed sosaix closed 10 years ago

sosaix commented 10 years ago

hi, i did try zabbix native vmware monitoring and Your vmbix alternative, vmbix has a lot great checks but unfortunately using names (vs UUIDs) causing problems. i have standard agent monitoring (from inside OSes) and combining that with vmbix checks causes name conflict between discovered VMs and existing agent-monitored hosts. i cant modify host prototype because host.host is used as an argument for vmbix checks.

when discovery rule would return two values: UUID and NAME, I could easy set discovered VMs names as UUID (which would not conflict existing agent-monitored systems) and display name as NAME to make it look more human friendly.

did You ever consider switching to UUID in key syntax? is there a hope for me? :)

best regards sosai-x

dav3860 commented 10 years ago

Hi, I will add the UUID to the vm.discover method. In fact, I don't use host prototypes to create the VMs as these hosts are mostly readonly. And having 2 Zabbix hosts for each VM is a pain. I use the provided python script to automatically create the VMs as regular hosts in Zabbix with the API. So they can be edited easily.

sosaix commented 10 years ago

but will you do a possibility to use UUIDs in an item argument?: vm.consolidation[UUID,needed] vm.cpu.load[UUID,cores] vm.cpu.load[UUID,total] vm.cpu.load[UUID,used] etc

dav3860 commented 10 years ago

It would require to refactor most of the code. But you could use host prototypes to create VMs with a Zabbix visible name corresponding to the VM display name. Then modify the template to use {HOST.NAME} instead of {HOST.HOST}, so it will use the visible name if it exists, or the host name.

sosaix commented 10 years ago

yeah, that should work, thx

dav3860 commented 10 years ago

I have committed this feature to a 1.1.9-dev version.

sosaix commented 10 years ago

much obliged

sosaix commented 10 years ago

just tested, visible names must be unique too, so without possibility to call keys by UUIDs agent-based hosts will be still in conflict.

when UUID could be used, host prototype could be like that: Hostname: {#UUID} Visible name: VM {#VIRTUALNAME}

and for Hypervisor discovery same thing: Hostname: {#UUID} Visible name: HV {#ESXHOST}

so that HV and VM prefixes would avoid conflicts with existing monitored OSes

dav3860 commented 10 years ago

I'll have a look at it.

dav3860 commented 10 years ago

As VMware doesn't provide a method to get the VM objects from its UUID, I need to implement an object cache to make this work with an acceptable performance.

sosaix commented 10 years ago

yep, cache filled up with every hv/vm/datastore discovery, probably size adjustable because of some env complexity

dav3860 commented 10 years ago

Hi, I have added a first attempt of a caching feature for VM/Hosts and performance metric objects. You can now set the useuuid = true parameter in the configuration file to query VmBix by UUID instead of name (default). There is jar in the releases section. Please let me know if it fits your needs.

sosaix commented 10 years ago

You are a Man ! working like a charm. thank You very much. Now it's far better and more usable than zabbix native vmware checks. I can truly recommend vmbix to everyone.

sosaix commented 10 years ago

one more thing with discovery of vms. templates are discovered as virtual machines to be monitored (could be filtered out). same thing with srm placeholders, they are also causes name conflicts (it should be also filtered out at discovery time).

no other issues at the moment.

dav3860 commented 10 years ago

I know, but I implemented all this logic in a new python discovery script that calls vmbix and the Zabbix API to create the VM hosts. I also added conditional filtering and assignment to groups/templates based on vmbix queries (on guest OS type, name, or VM folder for example).

sosaix commented 10 years ago

I missed that, I'm using a python free templates for simplicity reasons, that's why i missed that logic. thx again.

sosaix commented 10 years ago

i just looked inside pythons and saw that powered off machines are always skipped: state = zg.get("vm.powerstate[" + vm + "]") if state == '1': ...... else: logging.info("VM: " + vm + " is not powered-on")

wouldn't it be better to move that logic inside java discovery? probably no one ever will do something useful with powered-off machines and then some ppl (like me) could be able to use templates without python wrappers and zabbix api. what do You think?

dav3860 commented 10 years ago

In fact, I now use another python script. This one was very basic. The new one allows to add VMs & assign groups or templates based on conditional filters, like vm.powerstatus != 1 or vm.guest.os ~= Windows. And it's easier to implement the logic into a python script. For hosts and VMs, I could add the powerstate to the *.discovery methods output. This would allow to use a LLD filter in the discovery rule

sosaix commented 10 years ago

would be perfect