-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpost.sh
More file actions
executable file
·41 lines (38 loc) · 1.3 KB
/
post.sh
File metadata and controls
executable file
·41 lines (38 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
#
# AppDynamics example HTTP POST of metric to Machine Agent HTTP listener
# Maintainer: David Ryder
#
# Reference: https://docs.appdynamics.com/display/PRO45/Standalone+Machine+Agent+HTTP+Listener
#
POST_COUNT=${1:-"5"}
POST_INTERVAL=${2:-"15"}
VERBOSE=""
#VERBOSE="-v"
_AppD_PostSingleMetric() {
metricName=$1
aggregatorType=$2
metricValue1=$(( ( RANDOM % 10 ) + 1 ))
metricValue2=$(( ( RANDOM % 10 ) + 1 ))
METRIC_DATA="[ \
{\"metricName\":\"${metricName}|M1\", \
\"aggregatorType\":\"${aggregatorType}\", \
\"value\":\"${metricValue1}\"}, \
{\"metricName\":\"${metricName}|M2\", \
\"aggregatorType\":\"${aggregatorType}\", \
\"value\":\"${metricValue2}\"} \
]"
echo "Posting: $METRIC_DATA"
curl $VERBOSE -s \
--header "Content-Type: application/json" \
--data-binary "${METRIC_DATA}" \
-X POST "http://$APPD_MAC_AGENT_HOST:$APPD_MAC_AGENT_PORT$APPD_MAC_AGENT_PATH"
}
#AGGREGATOR_TYPE="AVERAGE"
#AGGREGATOR_TYPE="SUM"
AGGREGATOR_TYPE="OBSERVATION"
for i in $(seq $POST_COUNT )
do
_AppD_PostSingleMetric "Custom Metrics|APP_X" $AGGREGATOR_TYPE
sleep $POST_INTERVAL
done;