...
Code Block |
---|
|
#!/bin/bash
ver=$(java -version 2>&1 | grep "version" | cut -d" " -f 3 | sed 's/\"//g')
echo "java_ver=$ver"
gc_log=$( ls -t /usr/local/FlashphonerWebCallServer/logs/gc-core* | head -1)
echo "gc=$(tail -n1 $gc_log)"
exit 0 |
...
Code Block |
---|
|
-----Custom info-----
java_ver=java version "1.8.0_181"222
gc=2020-04-17T1223T15:2420:0356.430138+0700: 6431546.627835: [GC (Allocation Failure) 2020-04-17T1223T15:2420:0356.430138+0700: 6431546.627835: [ParNew: 34632K8978K->910K>325K(38080K9216K), 0.00391080103299 secs] 58661K26379K->24939K>18056K(122752K36172K), 0.00415170104582 secs] [Times: user |
Parameters returned by the script are available in all statistics formats. Note that using it is In Prometheus format, key and value will be converted to label:
Code Block |
---|
|
custom_stats{java_ver="1.8.0_222"} 1
custom_stats{gc="2020-04-23T15:11:11.235+0700: 961.933: [GC (Allocation Failure) 2020-04-23T15:11:11.235+0700: 961.933: [ParNew: 9216K->793K(9216K), 0.0042971 secs] 26617K->18195K(36172K), 0.0044029 secs] [Times: user"} 1 |
Known limits
1. It is not allowed to use pauses, long or high load operations in the script because this adds more latency to statistics output.
2. It is not allowed to use any quotes in keys and values to conform to Prometheus format. For example, the following value may not be used
Code Block |
---|
|
java_ver=openjdk version "1.8.0_222" |
and following may
Code Block |
---|
|
java_ver=1.8.0_222 |