Inside a callback action:

ActionCustomReport(<template>[, <params>][, title=<title>])


Generates a multiple line report with customized content. The report content can be viewed in the Web UI from the alert details for the agent.


Specifies the report template to use when generating this report. This template must be defined elsewhere in the script.

Specifies the title to be displayed for this action. The definition of <title> must use the Title function.

For example: title=Title("Generate final MAC report")


This function can only be used inside a callback action.

The script must contain the template (code) that generates and formats the report.

You can create a custom title for this action. The title you create can help the user of the Web UI to determine what action was executed. The title is displayed in the Action Results section of the Alert Details dialog box.


Example of calling the custom report action with a parameter:

ActionCustomReport(my_template, [self.params["author"]])

Example of generating a custom report:

 uri1 = '/rest/v1/system/bridge/vlans/{}/macs/?count'
        self.m1 = Monitor(uri1, 'Mac address count', [self.params['vlan_id']])
        self.r1 = Rule('MAC Address Learnt')
            '{} > 0 pause {} minutes',
            [self.m1, self.params['alert_pause']])

def gen_custom_report(self, event):
        vlan_id = self.params['vlan_id'].value
        type_s = ["dynamic", "static", "mclag", "vrrp"]
        mac_report = []
        for m in type_s:
            mac_all_dict = self.get_mac_result(vlan_id, m)
        final_report = self.generate_htmlreport(mac_report)
        ActionCustomReport(final_report, title=Title("Generate final MAC report"))

def get_mac_result(self, vlan_id, mac_type):
        url = '' \
              'vlans/' + str(vlan_id) + '/macs?count=true&filter=from:' + \
        r1 = self.rest_get(url)
        result = str(r1.json()["count"])
        return result

def generate_htmlreport(self, mac_report):
        html_prefix = '''<html>
            <table border="1">
                <tr align="center">
                    <th><td colspan="4"><b>Summary</b></td></th>
                <tr align="center">
                        <td colspan="4">
                            <b>Number of MAC learnt on various types</b>
                    <th>  DYNAMIC </th>
                <th>  STATIC  </th>
                    <th>  MCLAG   </th>
                    <th>  VRRP    </th>
            ''' + self.get_mac_htmlcontent(mac_report) + '''
        return html_prefix

For another example of a custom report, see the ospfv2_interface_state_flaps_impact_monitor solution on the Aruba Solutions Exchange.