Skip to content
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

vSphere: Ignore VM templates #768

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rhartmann
Copy link

Skip vSphere agent output for VM templates, as proposed in Idea 448538 and discussed in this forum post.

What is the expected behavior?
Do not discover VM templates. No need to monitor something that cannot be powered on.

What is the observed behavior?
Each VM template gets discovered as a separate service that is always WARN because VM template are always powered off.

Skip agent output for VM templates. This removes VM templates from discovery and avoids their piggyback data.
Copy link

github-actions bot commented Nov 13, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@rhartmann
Copy link
Author

I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA.

@Gulaschcowboy
Copy link
Contributor

Hi @rhartmann,
while I understand your motivation for this PR, I also know users that rely on the fact that the template is visible, as they need to ensure that the template exists in their environment.
You are right that power on/off doesn't matter for templates, but this can be addressed via a rule, also very efficiently if you have a naming concept.

But with your PR those services would disappear and templates would become completely invisible.
So I suggest not to implement this incompatible and breaking change.

@Gulaschcowboy
Copy link
Contributor

To add to that: If it would be configurable, it would be acceptable. But as a hard drop of those services, it is not.
Besides ignoring up/down state you could also go the route of creating a ignored_services rule to get rid of them for your use case.

Make ignoring templates optional (command-line argument). This adds backwards compatibilty: templates do not disappear unless opted-in.
@rhartmann rhartmann force-pushed the vsphere-ignore-templates branch from dd5ce48 to 075c213 Compare November 14, 2024 12:23
@rhartmann
Copy link
Author

I added an option similar to the option for placeholder VMs.

I am aware of the possibilities to get rid of (or change the state of) services based on naming conventions, but sadly I cannot apply a naming convention in my use case.

Btw, is it possible to use service labels instead? I mean, if the services were labelled as VMs or templates, the entire option to ignore templates would be unnecessary.

@Gulaschcowboy
Copy link
Contributor

Gulaschcowboy commented Nov 14, 2024

@rhartmann For the services labels you would need to create a rule that applies to VM names (here templates). As you don't have a naming concept, you have the same problem as with the ignored_services (or any other rule)
There is no built-in functionality in the agent_vsphere to assign service labels automatically.

As long as this is the case, service labels would just introduce another secondary rule step, that in fact can be handled already with a direct rule that doesn't need to rely on another rule.

@mo-ki
Copy link
Member

mo-ki commented Nov 25, 2024

Would it be possible to add discovered service labels to services belonging / caused by VM templates?

@rhartmann
Copy link
Author

Would it be possible to add discovered service labels to services belonging / caused by VM templates?

  • The agent section <<<esx_vsphere_vm>>> provides config.template and the parse function suppresses the entire section for VMs where config.template is true
  • The agent section <<<esx_vsphere_objects>>> neither considers nor provides config.template; this PR changes the agent so you can opt-in to suppress output for VMs where config.template is true

I suppose, to add service labels instead, the agent and both parse functions (one of which is a legacy check, so is it even worthwile?) would need changes. I don't intend to do those.

@mo-ki
Copy link
Member

mo-ki commented Nov 27, 2024

I don't intend to do those.

That's fair, I can understand that.

Also, it's not clear to me, how the plugin "VMware ESX: Location and State of VMs and Host Systems" should deal with this, adding service labels alone would not do anything.
But I like the service labels a bit better, because they're more flexible (as you could apply more rules than just ignoring them). OTOH, this is consistent with what we already have. I'll leave this to product management.

Code wise, there seems to be nothing wrong with it other than a missing migration (to add the new mandatory option), but we could easily add that; no action on your side needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants