AppDynamics Extension for Network Monitoring

Use Case

Use for monitoring network related metrics.

It uses the machine agent's Sigar library to retrieve the metrics, however these metrics (all or partial) can be overriden through scripting if required.

This extension works only with standalone machine agent.

Note : By default, the Machine agent and AppServer agent can only send a fixed number of metrics to the controller. To change this limit, please follow the instructions mentioned here.

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 NetworkMonitor.zip and unzip it to <machine_agent_dir>/monitors/
    2. Edit config.yaml file and provide the required configuration (see Configuration section)
    3. Restart the Machine Agent.

    Configuration

    config.yaml

    Edit the file config.yml located at <MachineAgent_Dir>/monitors/ The metricPrefix of the extension has to be configured as specified here. Please make sure that the right metricPrefix is chosen based on your machine agent deployment, otherwise this could lead to metrics not being visible in the controller.

    Note: Please avoid using tab (\t) when editing yaml files. You may want to validate the yaml file using a yaml validator.

    ParamDescription
    networkInterfacesThe network interface to monitor. To monitor multiple interfaces, separate the values using comma, e.g. eth0, eth1, eth2
    overrideMetricsUsingScriptFileIf set to true, it will execute the defined script for the OS to retrieve metrics. Default value is false.
    scriptTimeoutInSecThe timeout in seconds of script execution.
    scriptFiles (osType)Type of OS: It's either 'windows' for Windows or 'unixBase' for other OS such as Linux, MAC, Solaris, etc.
    scriptFiles (filePath)The path of the script file. Either provide a relative path from the machine agent's installation dir or an absolute path. Two script templates are provided, one for each osType.
    deltaMetricsComma separated full path of the metrics for which delta (present - previous) needs to be computed.
    metricPrefixThe path prefix for viewing metrics in the metric browser. Default is "Custom Metrics|Network|"

     

    Below is an example config for monitoring multiple interfaces with enabled metrics scripting override:

    
    #In case of linux, networkInterface names are of the form eth*
    # In Windows, please use the network full name from Device Manager ("Intel(R) PRO/1000 MT Desktop Adapter")
    networkInterfaces: [ "eth0", "eth1", "Intel(R) PRO/1000 MT Desktop Adapter"
    ]
    
    overrideMetricsUsingScriptFile: true
    
    scriptTimeoutInSec: 60
    
    scriptFiles:
      - osType: windows
        filePath: monitors/NetworkMonitor/scripts/windows-metrics.bat
      - osType: unixBase
        filePath: monitors/NetworkMonitor/scripts/unix-base-metrics.sh
    
    # Comma separated full path of the metrics for which delta (present - previous) needs to be computed.
    # For eg. deltaMetrics: ["TCP|State|Bound", "TCP|Segments Retransmitted"]
    deltaMetrics: []
    
    metricPrefix:  "Custom Metrics|Network|"
    

    Script File

    There maybe cases where Sigar doesn't work on your environment or you've a preferred way of retrieving the metrics. In any case, you have the flexibility to override some or all metrics using scripting.

    There are two script templates provided:

    1. unix-base-metrics.sh for non-windows environment
    2. windows-metrics.bat for windows environment

    Update the relevant script template by uncommenting out the metrics you wish to override and provide the value.

    Below is an example override on some TCP State metrics in unix-base-metrics.sh:

    ...
    echo "name=TCP|State|Close Wait,value=" `netstat -an | grep -i CLOSE_WAIT | wc -l`
    echo "name=TCP|State|Establised,value=" `netstat -an | grep -i ESTABLISHED | wc -l`
    echo "name=TCP|State|Fin Wait1,value=" `netstat -an | grep -i FIN_WAIT_1 | wc -l`
    echo "name=TCP|State|Fin Wait2,value=" `netstat -an | grep -i FIN_WAIT_2 | wc -l`
    echo "name=TCP|State|Listen,value=" `netstat -an | grep -i LISTEN | wc -l`
    ...
    

     

    Below is an example override on custom metrics in windows-metrics.bat:

    ...
    set cmd="netstat -an | find "192.168.31" /c"
    FOR /F %%i IN (' %cmd% ') DO SET val=%%i
    echo name=Autotrader^|Listen,value=%val%
    ...
    

    Metrics

    Metric path is typically: Application Infrastructure Performance|<Tier>|Custom Metrics|Network| followed by the individual metrics below:

    Network Interface

    Note: <network_interface> is replaced with the actual network interface name, e.g eth0

    MetricDescription
    <network_interface>|RX KiloBytesThe total kilo bytes received
    <network_interface>|RX DroppedThe number of dropped packets due to reception errors
    <network_interface>|RX ErrorsThe number of damaged packets received
    <network_interface>|RX FrameThe number received packets that experienced frame errors
    <network_interface>|RX OverrunsThe number of received packets that experienced data overruns
    <network_interface>|RX PacketsThe number of packets received
    <network_interface>|SpeedThe speed in bits per second
    <network_interface>|TX KiloBytesThe total kilo bytes transmitted
    <network_interface>|TX CarrierThe number received packets that experienced loss of carriers
    <network_interface>|TX CollisionThe number of transmitted packets that experienced Ethernet collisions
    <network_interface>|TX DroppedThe number of dropped transmitted packets due to transmission errors
    <network_interface>|TX ErrorsThe number of packets that experienced transmission error
    <network_interface>|TX OverrunsThe number of transmitted packets that experienced data overruns
    <network_interface>|TX PacketsThe number of packets transmitted

    TCP

    MetricDescription
    TCP|Active OpensThe number of active opens
    TCP|Attempt FailsThe number of attempted connection failed
    TCP|Conn EstablishedThe number of connection established
    TCP|Resets ReceivedThe number of resets received
    TCP|Bad SegmentsThe number of bad segments
    TCP|Segments ReceivedThe number of segments received
    TCP|Inbound TotalTotal number of TCP inbound connections
    TCP|Resets SentThe number of resets sent
    TCP|Segments SentThe number of segments sent
    TCP|Outbound TotalTotal number of TCP outbound connections
    TCP|Passive OpensThe number of passive opens
    TCP|Segments RetransmittedThe number of segments retransmitted

    TCP State

    MetricDescription
    TCP|State|BoundThe number of bound connections
    TCP|State|Close WaitThe number of connections waiting for termination request from the local user
    TCP|State|ClosedThe number of closed connections
    TCP|State|ClosingThe number of connections waiting for termination acknowledgment
    TCP|State|EstablisedThe number of open connections
    TCP|State|Fin Wait1The number of connections waiting for termination requests from the remote TCP or acknowledgment of termination request previously sent
    TCP|State|Fin Wait2The number of connections waiting for termination requests from the remote TCP
    TCP|State|IdleThe number of connections in idle
    TCP|State|Last AckThe number of connections waiting for lask acknowledgment of termination request sent to remote TCP
    TCP|State|ListenThe number of listening for connections
    TCP|State|Syn RecvThe number of confirming connection requests acknowledgment after having both received and sent a connection request
    TCP|State|Syn SentThe number of waiting for a matching connection request after having sent a connection request
    TCP|State|Time WaitThe number of connections waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request

    Other

    MetricDescription
    All Inbound TotalTotal number of incoming connections
    All Outbound TotalTotal number of outgoing connections

    Troubleshooting

    1. Please look at the troubleshooting document and make sure that everything is followed correctly.
    2. Verify Machine Agent Data:Please start the Machine Agent without the extension and make sure that it reports data. Verify that the machine agent status is UP and it is reporting Hardware Metrics
    3. If there is a java.lang.NoClassDefFoundError: org/hyperic/sigar/SigarException in machine-agent.log, please copy all the sigar libraries/dependencies from MachineAgent_Home/lib to MachineAgent_Home/monitorsLibs including sigar.jar and .so files to avoid this error
    4. Collect Debug Logs: Edit the file, <MachineAgent>/conf/logging/log4j.xml and update the level of the appender "com.appdynamics"  to debug

    Custom Dashboard

    NetworkMonitorCustomDashboard.png

    Platform Tested

    PlatformVersion
    Ubuntu12.04 LTS
    Windows7
    Mac OSX10.9.1

    Version

    1.0.4 4th Aug, 2016 - Support for configurable delta metrics

    1.0.5 9th Nov, 2017 - Support for n/w interface names in Windows

    1.0.6 19th Feb, 2018 - Updated Licenses

    Contributing

    Always feel free to fork and contribute any changes directly here on GitHub

    Support

    For any questions or feature request, please contact AppDynamics Center of Excellence.