Menu

#4276 [HHQ-4175] Add API support for alertdefinition EmailAction

Bug
open
None
5
2012-10-09
2010-07-31
No

http://jira.hyperic.com/browse/HHQ-4175


Currently the only way to setup notifications via the API is through escalations. While this covers most cases and is the preferred method of notification, it would be nice to also have the ability to sync EmailActions for definitions to allow notification of users, roles and other recipients outside of an escalation.



This will work just like other Actions, however like the ControlAction, we'll need to do some translation on list and sync to make the output more user friendly. Here is the proposed format:



{code}


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>


<AlertDefinitionsResponse>


    <Status>Success</Status>


    <AlertDefinition id="10103" name="High Load" description="" priority="2" enabled="true" active="true" frequency="0" count="0" range="0" willRecover="false" notifyFiltered="false" controlFiltered="false">


        <Resource id="10881" name="Morgan.local"/>


        <AlertCondition required="true" type="1" thresholdValue="5.0" thresholdComparator="&gt;" thresholdMetric="Load Average 5 Minutes"/>


        <AlertAction id="10121" className="com.hyperic.hq.bizapp.server.action.control.ControlAction">


            <AlertActionConfig key="resourceId" value="10882"/>


            <AlertActionConfig key="action" value="runGarbageCollector"/>


        </AlertAction>


        <AlertAction id="10122" className="com.hyperic.hq.bizapp.server.action.email.EmailAction">


            <AlertActionConfig key="notifyType" value="roles"/>


            <AlertActionConfig key="names" value="Super User Role,Guest Role"/>


            <AlertActionConfig key="sms" value="false"/>


        </AlertAction>


        <AlertAction id="10123" className="com.hyperic.hq.bizapp.server.action.email.EmailAction">


            <AlertActionConfig key="notifyType" value="users"/>


            <AlertActionConfig key="names" value="hqadmin,guest"/>


            <AlertActionConfig key="sms" value="false"/>


        </AlertAction>


        <AlertAction id="10124" className="com.hyperic.hq.bizapp.server.action.email.EmailAction">


            <AlertActionConfig key="notifyType" value="email"/>


            <AlertActionConfig key="names" value="ryan@host.com,morgan@host.com"/>


            <AlertActionConfig key="sms" value="false"/>


        </AlertAction>


    </AlertDefinition>


</AlertDefinitionsResponse>


{code}



This change will not require any API changes or changes to the XML schema. The only addition is now AlertAction's with a classname of com.hyperic.hq.bizapp.server.action.email.EmailAction will be supported for list/sync.



In addition to the changes above, we will also expose these to the command line alertdefinition syncing to allow for easy assignment of notifications to batches of alert definitions. The new options will be:



alertdefinition sync --assignUserNotification="username1,username2"


alertdefinition sync --assignRoleNotification="Role Name1,Role Name2"


alertdefinition sync --assignOtherNotification="list,of,email,addresses"



This will be in addition to the existing --assignControlAction, --assignEscalation, --assignScriptAction, and --clearActions.


Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.