-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-datadog-agent.sh
114 lines (98 loc) · 2.96 KB
/
install-datadog-agent.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
#1. Check for variable values
if [[ -z "$NODE_NAME" ]] || [[ -z "$NODE_TYPE" ]] || [[ -z "$INSTANCE" ]] || [[ -z "$DD_API_KEY" ]] || [[ -z "$NETWORK" ]]
then
echo "Please put all variable values correctly."
exit 1
else
DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=$DD_API_KEY DD_SITE="datadoghq.com" bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"
fi
#2. TAG Set Up
if [ $NODE_TYPE == "cn" ]
then
cat <<EOF>> /etc/datadog-agent/datadog.yaml
hostname: $NODE_NAME
logs_enabled: true
process_config:
enabled: true
blacklist_patterns:
- ^([^k]|k(k|ck)*([^kc]|c[^kn]))*(k(k|ck)*c?)?$
enable_gohai: false
cloud_provider_metadata: [ ]
tags:
- nodetype:$NODE_TYPE
- instance:$INSTANCE
- network:$NETWORK
EOF
mkdir -p /etc/datadog-agent/conf.d/go.d
cat << EOF > /etc/datadog-agent/conf.d/go.d/conf.yaml
#4. Log Config
logs:
- type: file
path: $LOG_DIR/kcnd.out
service: klaytn-cn
source: go
sourcecategory: sourcecode
EOF
else
cat <<EOF>> /etc/datadog-agent/datadog.yaml
hostname: $NODE_NAME
logs_enabled: false
process_config:
enabled: true
blacklist_patterns:
- ^([^k]|k(k|pk)*([^kp]|p[^kn]))*(k(k|pk)*p?)?$
enable_gohai: false
cloud_provider_metadata: [ ]
tags:
- nodetype:$NODE_TYPE
- instance:$INSTANCE
- network:$NETWORK
EOF
fi
#3. Klaytn Custom Metric Set Up
cat << EOF > /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml
init_config:
instances:
- openmetrics_endpoint: http://localhost:61001/metrics
metrics:
- klaytn_discover_ping
- klaytn_discover_pong
- klaytn_txpool_refuse
- klaytn_chain_finalize
- klaytn_rpc_counts_total
- klaytn_p2p_DialTryCounter
- klaytn_p2p_InboundTraffic
- klaytn_p2p_OutboundTraffic
- klaytn_p2p_CNPeerCountGauge
- klaytn_p2p_ENPeerCountGauge
- klaytn_p2p_PNPeerCountGauge
- klaytn_blockchain_block_tx_counter
- klaytn_blockchain_head_blocknumber
- klaytn_klay_prop_blocks_out_traffic
- klaytn_klay_prop_blocks_in_traffic
- klaytn_blockchain_bad_block_counter
- klaytn_consensus_istanbul_core_round
- klaytn_consensus_istanbul_core_councilSize
- klaytn_chain_validate
- klaytn_tx_pool_pending_gauge
- klaytn_p2p_PeerCountGauge
- klaytn_consensus_istanbul_core_currentRound
- klaytn_chain_inserts
- klaytn_consensus_istanbul_core_timer
- klaytn_tx_pool_queue_gauge
- klaytn_klay_db_chaindata_body_disk_read
- klaytn_klay_db_chaindata_body_disk_write
- klaytn_klay_prop_txns_in_packets
- klaytn_klay_prop_txns_in_traffic
- klaytn_klay_prop_txns_out_packets
- klaytn_klay_prop_txns_out_traffic
- klaytn_klay_prop_blocks_in_packets
- klaytn_klay_prop_blocks_out_packets
- klaytn_p2p_DialFailCounter
- klaytn_consensus_istanbul_core_hashLock
- klaytn_consensus_istanbul_core_committeeSize
- klaytn_build_info
EOF
#5. APPLY datadog-agent Config
systemctl restart datadog-agent