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

Reply
  • 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

Children
  • Hey flackovic, this is the trigger condition I am using.

    I did add the your code to my alert but it does not bring any info back. 

    Also, don;t you think it is weird that the only place in the database where you can find the VcenterName is in the Orion.VIM.VirtualDisks table?

    Thanks so much for looking at this, I am super excited to get past this one!!  :-)

  •  Yeah that should work. I did a quick test using a mock up with that alert type and scope. No goodnik. I tried a couple of variations - also no good. This is a weird one. Already bumped the feature request. 

  • Hi Rachel,

    Came to this thread thinking "I know this", and then saw that alert condition and thought "when did that go in?!"

    in general the macros section kinda work by calling a value with reference to whatever table your alert condition starts on (home). So if someone's alert starts in the hardware table, their solution wont work for you, same for the hosts table or the vcenter table, or whatever else.

    No idea you could start in triggered alarms now!

    I'll give it a test when I can, but in general you can either:

    1) use the macros section, select by category, and look through tables that seem related to what you're trying to achieve

    2) build your own in the format of a SWQL query a bit like

    SELECT r.thing
    FROM relatedTable r

    or 

    SELECT h.detailTable.thing
    FROM homeTable h

    That produces the sort of data you care about, then add a where condition like

    WHERE r.ID = '${ID_MacroFromTheSelector}'

    So that it filters down to the thing you care about

    (then you might also need to add a block for a UNION or CASE or subquery such that it always produces output and doesnt spit back the SWQL)



  • looking at what i guess might be the table that works on there's a structure like this


    Hardware alarms would be on the host, so i'd try something like

    tas.Host.Cluster.DataCenter.VCenter.Name FROM Cortex.Orion.Virtualization.TriggeredAlarmState tas
  • Hey Adam,  I did try your code but it only brings the IP address up.  Are you actually getting the name or just the IP?

    SELECT E0.[DisplayName], E0.Host.DataCenter.VCenter.name
    FROM Cortex.Orion.Virtualization.TriggeredAlarmState AS E0
    WHERE ( ( ( E0.[Alarm].[Name] LIKE '%vmnic%' ) AND ( E0.[Host].[Status] != '1' ) ) )
  •  Hey Adam - I hadn't looked at the cortex entities. That clued me in. I also agree that the vm triggered alert condition is a new entity also. 

    I was able to get the following to work, I added both the name and displayname. The name returned only the IP address for me also. The displayname gave the actual name. The where condition is stripped down as I wanted enough data to work with. 

    SELECT E0.[DisplayName], E0.Host.DataCenter.VCenter.name, E0.Host.DataCenter.VCenter.DisplayName AS [Vcenter Name] FROM Cortex.Orion.Virtualization.TriggeredAlarmState E0 WHERE ( E0.[Host].[Status] != '1' )
  • Looks good! So nice when you throw something out at the end of a shift, come back and it's sorted

    Marc's got the right datapoint below, displayname rather than name

    For production purposes i'd reccomend changing the where condition to stick an ID macro in, but then it's pretty much done

    and then maybe could make it standard maybe somehow

  • I wish! Best way to make this a standard in the product is the feature request. That said, I have added this to my collection of "great ideas from Thwacksters" to share with future customers with the same need. Slight smile

    I'd love to see an example of the final output email (appropriately redacted screenshot of course) to tie a nice bow on the whole process. 

  • ${N=SwisEntity;M=Host.HostID}${N=SWQL;M=SELECT E0.Host.DataCenter.VCenter.name

    FROM Cortex.Orion.Virtualization.TriggeredAlarmState E0

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

  • Hate to say it didn't work but..  it didn't work.  :-)

    Here is a picture where I configured the message.

    Then this is what I get in the email.

    I know we are getting closer!!!