AppDynamics Extension for Event Publisher Monitoring

The Event Publisher Extension executes scripts at various intervals and reports events based on exit code generated by the script.

This extension works only with the standalone machine agent.

Prerequisites

  • Before the extension is installed, the prerequisites mentioned here need to be met. Please do not proceed with the extension installation if the specified prerequisites are not met.
  •  

    Installation

    1. Download the file EventPublisherMonitor.zip
    2. Unzip the downloaded file and cd into EventPublisherMonitor
    3. Open the monitor.xml file and edit the project path to the EventPublisherMonitor directory that was just created.
    4. Open the events.xml file and add the appropriate scripts such as those in the events.xml example.
    5. Restart the Machine Agent by setting -Dmetric.http.listener=true.
    6. In the AppDynamics controller, look for events in <App ID> -> Events

    Note: The event scripts must have read access by the Machine Agent for the monitoring extension to execute them.
    Note: While starting the machine agent please set the property metric.http.listener to true
    ex: java -Dmetric.http.listener=true -jar machineagent.jar

     

    XML Examples

    monitor.xml

     

    ParamDescription
    project_pathLocation of the events script root directory
    worker_countNumber of worker thread(s) that will be spawned as part of the Executor Pool to execute the scripts

     

    <monitor>
        <name>EventPublisherMonitor</name>
        <type>managed</type>
        <description>Event Publisher Monitor</description>
        <monitor-configuration></monitor-configuration>
        <monitor-run-task>
            <execution-style>periodic</execution-style>
            <name>Event Publisher Monitor Run Task</name>
            <display-name>Event Publisher Monitor Task</display-name>
            <description>Event Publisher Monitor Task</description>
            <type>java</type>
            <execution-timeout-in-secs>60</execution-timeout-in-secs>
            <task-arguments>
                <argument name="project_path" is-required="true" default-value="/home/satish/AppDynamics/MachineAgent/monitors/EventPublisherMonitor"/>
                <!-- Controls how many worker threads would be spawned to execute the scripts -->
                <argument name="worker_count" is-required="false" default-value="5"/>
            </task-arguments>
            <java-task>
                <classpath>event-publisher-extension.jar</classpath>
                <impl-class>com.appdynamics.monitors.events.EventPublisherMonitor</impl-class>
            </java-task>
        </monitor-run-task>
    </monitor>
    
    

    events.xml

     

    ParamDescription
    <name>Name of the event
    <path>Path to the shell file
    <period>(seconds) - Delay between consecutive calls.
    <max-wait-time>(seconds) - seconds to wait before force killing this script. If not specified or is more than period then assumes the value specified in period.
    <arguments>Arguments that will be passed to the script

     

        <events>
            <event>
                <name>Tomcat Status</name>
                <summary>Tomcat Status</summary>
                <comment>Event for tomcat status</comment>
                <path>/home/satish/AppDynamics/Code/extensions/event-publisher-extension/src/main/resources/config/scripts/script.sh</path>
                <outputs>
                    <output>
                        <exitCode>0</exitCode>
                        <status>Down</status>
                    </output>
                    <output>
                        <exitCode>1</exitCode>
                        <status>Up</status>
                    </output>
                </outputs>
                <arguments/>
                <!--Number of seconds to wait to execute the script periodically -->
                <period>60</period>
                <!-- Number of seconds to wait before force killing this script. If not specified or is more than period then assumes the value specified in period-->
                <max-wait-time>5</max-wait-time>
            </event>
        </events>
    

    Example script

     

    #!/bin/bash
    COUNT=`ps -ef | grep tomcat| grep -v grep | wc -l`
    if [ "$COUNT" = 0 ]; then
        exit 0
    else
        exit 1
    fi
    

    Above script file will check whether tomcat is up or not. Exit code from the script will be looked up in the events.xml to get the status. From the above script

    • if exit code is 0 then the status is Down
    • if exit code is 1 then the status is Up

    Contributing

     

    Always feel free to fork and contribute any changes directly via GitHub.

     

    Troubleshooting

     

    Please look at the troubleshooting document and make sure that everything is followed correctly.

     

    Support

     

    For any support questions, please contact help@appdynamics.com.

     

    Version:

    1.0.1

    Compatibility:

    3.7

    Last Update:

    2/19/2018