Products
Applications
Support
Company
How To Buy
Skip to main content (Press Enter).
Sign in
Skip auxiliary navigation (Press Enter).
Register
Skip main navigation (Press Enter).
Toggle navigation
Search Options
Home
Communities
All Communities
Application Networking and Security
Enterprise Software
Mainframe Software
Software Defined Edge
Symantec Enterprise
Tanzu
VMware {code}
VMware Cloud Foundation
Blogs
All Blogs
Enterprise Software
Mainframe Software
Symantec Enterprise
VMware
Events
All Events
Enterprise Software
Mainframe Software
Symantec Enterprise
VMware
Water Cooler
Betas
Flings
Education
Groups
Enterprise Software
Mainframe Software
Symantec Enterprise
VMware
Members
vCenter
Cloud & SDDC
View Only
Community Home
Threads
Library
Events
Members
Back to discussions
Expand all
|
Collapse all
sort by most recent
sort by thread
Including group name in alert email template
johnp_hyperic
Jan 06, 2009 04:32 AM
Hi All, I'm wondering if there is a method to include the group in which a resource resides in email ...
jvalkeal_hyperi
Jan 06, 2009 10:50 AM
Here's how to list those through groovy console. ---- import org.hyperic.hq.authz.server.session.ResourceGroupManagerEJBImpl ...
jvalkeal_hyperi
Jan 06, 2009 11:41 AM
Ok, it works. Here's modified default template for quick example.
johnp_hyperic
Jan 07, 2009 06:24 AM
Thats excellent - implemented, tested and running!
1.
Including group name in alert email template
0
Recommend
johnp_hyperic
Posted Jan 06, 2009 04:32 AM
Reply
Reply Privately
Options Dropdown
Hi All,
I'm wondering if there is a method to include the group in which a resource resides in email alerts. I am using Hyperic to monitor a number of customers servers, which each customer having a group in Hyperic. I have a few customers whose servers are called "Server" so it's important I can differentiate between them.
I know you can alter the templates by editing the text_email and html_email gsp files, but I'm not sure what the property would be for resouce groups.
JP
2.
RE: Including group name in alert email template
0
Recommend
jvalkeal_hyperi
Posted Jan 06, 2009 10:50 AM
Reply
Reply Privately
Options Dropdown
Here's how to list those through groovy console.
----
import org.hyperic.hq.authz.server.session.ResourceGroupManagerEJBImpl
import org.hyperic.hq.authz.server.session.ResourceManagerEJBImpl
import org.hyperic.hq.appdef.shared.AppdefEntityID
def rgMan = ResourceGroupManagerEJBImpl.one
def rMan = ResourceManagerEJBImpl.one
def aid = new AppdefEntityID("3:10247")
def r = rMan.findResource(aid)
def collection = rgMan.getGroups(r)
def gStr = new StringBuffer()
gStr.append("Groups containing this resource:\n")
collection.each{
if(!it.system)
gStr.append(it.name + "\n")
}
gStr
----
In this example aid value can be found from link when browsing resources.
http://localhost:7080/Resource.do?eid=3:10247
To use this in text_email.gsp, do something like this:
1. add import to start of file. (there's already few of those)
import org.hyperic.hq.authz.server.session.ResourceGroupManagerEJBImpl
2. gsp template runner already gives resource, so add below between <% %> section:
def rgMan = ResourceGroupManagerEJBImpl.one
def collection = rgMan.getGroups(resource)
def gStr = new StringBuffer()
gStr.append("Groups containing this resource:\n")
collection.each{
if(!it.system)
gStr.append(it.name + "\n")
}
3. finally in text section add new variable to print it to output text
${gStr}
I havent tried this but it should work.
3.
RE: Including group name in alert email template
0
Recommend
jvalkeal_hyperi
Posted Jan 06, 2009 11:41 AM
|
view attached (0)
Reply
Reply Privately
Options Dropdown
Ok, it works. Here's modified default template for quick example.
4.
RE: Including group name in alert email template
0
Recommend
johnp_hyperic
Posted Jan 07, 2009 06:24 AM
Reply
Reply Privately
Options Dropdown
Thats excellent - implemented, tested and running!
×
New Best Answer
This thread already has a best answer. Would you like to mark this message as the new best answer?
Copyright 2024. All rights reserved.
Powered by Higher Logic