This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

How do I get the vcenter name in alert emails

Hey ya'll,  I am using alerts triggered by VMware Triggered Alarm to find hardware issues on our VMware Hosts.  I have the alert working but would LOVE to be able to insert the variable for the vcenter name into the email.

 

Unfortunately the only place I can find the vcenter name is in the Orion.VIM.VirtualDisks table.

 

Is there a way to Join enough tables so that I can get the vcenter name in the email alerts.

Parents
  • Hello! Wave

    I'd love to take a crack at this! Do you mind sharing your alert Trigger Condition page, if possible? That will let me know what you're already working with and what conditions you're looking to alert on. Feel free to PM me on thwack if you don't feel comfortable posting on this post.

  • I did some initial testing in my lab with a dummy alert I set up. Please add this to your e-mail message body:

    ${N=SWQL;M=SELECT VCenterName
    FROM Orion.VIM.VirtualDisks
    WHERE VirtualMachineID = ${N=SwisEntity;M=VirtualMachine.VirtualMachineID}}


    That should pull the VCenterName record from the Orion.VIM.VirtualDisks table you provided based off of the dynamic VirtualMachineID of the VM that triggered the alert.

    Please let me know if that works for you. If not, I'll gladly revisit. Thumbsup

  • I got this from marcrobinson and it actually works!!!

    ${N=SWQL;M=SELECT E0.Host.DataCenter.VCenter.displayname

    FROM Cortex.Orion.Virtualization.TriggeredAlarmState E0

    WHERE E0.relatedhost = ${N=SwisEntity;M=Host.HostID}}

     

    I really appreciate all ya'lls help!!!

  • Whoo hoo! I'm also going to point a few people I know in PM and etc to this thread. Some great insight. Not sure any of them will actually respond, might just lurk, but this is a great use case

    I'm shamelessly snagging the SWQL too in case another customer can use it! 

    Thanks everyone! I love it! Heart

  • Adam, I like you explanations, as I omitted this from my answers. I agree that the Top1 is ugly, but can work. I was thinking about your isnull too. This might also work, instead of the case function. I tend to forget that hosts can be deployed without a vcenter so I didn't think about trapping that condition with something user friendly.

    This comment is a general one to   - you have to link through four navigation properties/entities to get this bit of information that should be more readily available. If you could pass that along also?

    ${N=SWQL;M=SELECT ISNULL(E0.Host.DataCenter.VCenter.displayname,'No Vcenter') AS [Vcenter Name] FROM Cortex.Orion.Virtualization.TriggeredAlarmState E0 WHERE E0.relatedhost = ${N=SwisEntity;M=Host.HostID}}

     

  • I have a different alert I am trying to get the vcenter from.  This one is pulling from the datastore table.  I tried this and it does not seem to work. 

    ${N=SWQL;M=SELECT E0.Hosts.DataCenter.VCenter.displayname
    FROM Orion.VIM.Datastores E0
    WHERE E0.Hosts.HostID = ${N=SwisEntity;M=Host.HostID}}

  • Taking a quick peek and hoping that the slight shift in entity for the alert (changing from virtual host to virtual datastore) is not the cause. This can cause some interesting and subtle changes in formatting the swql variable to retrieve the value. SAM application and component alerts are a great example, as you slightly change the swql variables for a node caption in the alert actions. 

    What is the error message when you simulate the action in the web console? Does it spit out the query with the HostId resolved in your Where statement, or is just the query as you pasted above? If it is the latter, then it may be what I was thinking about. 

  •  

    SELECT top 1 d.Clusters.DataCenter.VCenter.DisplayName from orion.vim.Datastores d where d.DataStoreID = {put a datastore ID macro here}
  •   I was looking at the following and noticed that multiples could be returned. Top 1 eliminates that.

    SELECT TOP 1  H.DataCenter.VCenter.displayname 

    FROM Orion.VIM.HOSTS H 

    WHERE H.DataStores.DataStoreID = ${N=SwisEntity;M=DataStoreID}

    The other entity that looks good based on the earlier thread are those cortex entities. 

    SELECT TAS.RelatedDataCenter, tas.RelatedHost, tas.RelatedDatastore
    FROM Cortex.Orion.Virtualization.TriggeredAlarmState TAS
    Where TAS.RelatedDatastore = ${N=SwisEntity;M=DataStoreID}
  •   Hey Cheryl, this is something to ponder as you really need to work backwards on some of the vim entities. They work but you really need to watch how you link them. Rachel's initial approach works if you can resolve the hostid, but you cannot as it is written. I was surprised that I had to work differently to get the answer, and I noticed that Adam started directly in a different  entity for the same answer also. I would love to get your thoughts on some of this and how to help people work through some of this quicker. 

Reply Children
No Data