JVM metrics for the AWS CloudWatch with jstat.
- Amazon Linux 2
- Open JDK 8 (including Amazon Corretto 8)
- awscli
- jps
- jstat
- A utility shell script to send metrics of JVM to the AWS CloudWatch.
You must to change the value of NAME with jar filename shown by jps command.
NAME=JARfilenameByJps
You can write a part of the jar filename.
$ sudo cp jvm.sh /usr/local/bin/
$ sudo chmod +x /usr/local/bin/jvm.sh
$ sudo cp jvm_cron /etc/cron.d/jvm
You can be suitably change these file names.
The following policy is required.
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"cloudwatch:PutMetricData",
"cloudwatch:GetMetricStatistics",
"cloudwatch:ListMetrics",
"ec2:DescribeTags"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
- Improved script to pass shellcheck
- Replaced
$UIDwith$(id -u)for POSIX sh compatibility - Replaced legacy backticks with
$(...)notation - Added double quotes to prevent globbing and word splitting
- Removed unnecessary
$in arithmetic expressions
- Replaced
- initial release