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 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. 

  • hey Marc! *waves^

    I understand what you're saying, but I am also fine confessing I don't know how to improve it. This is just a wee bit outside my scope of expertise. LOL, I think a Product Manager would be a good place to start, as that is who I would go to on my own anyway. LOL

    I'm curious, so I'll inquire and see if any of them have anything to offer. 

  • Worth mentioning that the variables selection screen has aweful performance times, in which case linking more stuff may not be ideal. Worth a big refresh

  •   Adam is too kind in his assessment of the performance during variable loading. Hateful comes to mind when waiting on variables to load when you search. But the fact that VIM returns very little in this case is even worse. 

Reply Children