diff --git a/hertzbeat-collector/hertzbeat-collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/ssh/SshCollectImpl.java b/hertzbeat-collector/hertzbeat-collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/ssh/SshCollectImpl.java index 0cce85ddbca..7fef3762f61 100644 --- a/hertzbeat-collector/hertzbeat-collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/ssh/SshCollectImpl.java +++ b/hertzbeat-collector/hertzbeat-collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/ssh/SshCollectImpl.java @@ -56,6 +56,7 @@ import org.apache.sshd.client.session.ClientSession; import org.apache.sshd.common.SshException; import org.apache.sshd.common.channel.exception.SshChannelOpenException; +import org.apache.sshd.common.config.keys.FilePasswordProvider; import org.apache.sshd.common.util.io.output.NoCloseOutputStream; import org.apache.sshd.common.util.security.SecurityUtils; import org.springframework.util.StringUtils; @@ -322,7 +323,13 @@ private ClientSession getConnectSession(SshProtocol sshProtocol, int timeout, bo clientSession.addPasswordIdentity(sshProtocol.getPassword()); } else if (StringUtils.hasText(sshProtocol.getPrivateKey())) { var resourceKey = PrivateKeyUtils.writePrivateKey(sshProtocol.getHost(), sshProtocol.getPrivateKey()); - SecurityUtils.loadKeyPairIdentities(null, () -> resourceKey, new FileInputStream(resourceKey), null) + FilePasswordProvider passwordProvider = (session, resource, index) -> { + if (StringUtils.hasText(sshProtocol.getPrivateKeyPassphrase())) { + return sshProtocol.getPrivateKeyPassphrase(); + } + return null; + }; + SecurityUtils.loadKeyPairIdentities(null, () -> resourceKey, new FileInputStream(resourceKey), passwordProvider) .forEach(clientSession::addPublicKeyIdentity); } // else auth with localhost private public key certificates diff --git a/hertzbeat-common/src/main/java/org/apache/hertzbeat/common/entity/job/protocol/SshProtocol.java b/hertzbeat-common/src/main/java/org/apache/hertzbeat/common/entity/job/protocol/SshProtocol.java index 7ba4cf4cd02..5c2e9c33653 100644 --- a/hertzbeat-common/src/main/java/org/apache/hertzbeat/common/entity/job/protocol/SshProtocol.java +++ b/hertzbeat-common/src/main/java/org/apache/hertzbeat/common/entity/job/protocol/SshProtocol.java @@ -60,6 +60,11 @@ public class SshProtocol implements CommonRequestProtocol, Protocol { * Private key (optional) */ private String privateKey; + + /** + * private key passphrase (optional) + */ + private String privateKeyPassphrase; /** * reuse connection session diff --git a/hertzbeat-manager/src/main/resources/define/app-almalinux.yml b/hertzbeat-manager/src/main/resources/define/app-almalinux.yml index 53e167f7804..b10d0ffdd0a 100644 --- a/hertzbeat-manager/src/main/resources/define/app-almalinux.yml +++ b/hertzbeat-manager/src/main/resources/define/app-almalinux.yml @@ -115,6 +115,18 @@ params: required: false # hide param-true or false hide: true + # field-param field key + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +170,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +240,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +308,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +353,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +393,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +441,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +483,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -505,6 +525,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-centos.yml b/hertzbeat-manager/src/main/resources/define/app-centos.yml index f9544b36c6d..f374d6c5153 100644 --- a/hertzbeat-manager/src/main/resources/define/app-centos.yml +++ b/hertzbeat-manager/src/main/resources/define/app-centos.yml @@ -116,6 +116,18 @@ params: required: false # hide param-true or false hide: true + # field-param field key + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -159,6 +171,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -227,6 +241,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -294,6 +309,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -338,6 +354,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -377,6 +394,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {gsub(":", "", $1); print $1,$2,$10}' @@ -424,6 +442,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -465,6 +484,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -506,6 +526,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-coreos.yml b/hertzbeat-manager/src/main/resources/define/app-coreos.yml index 92b2d336b04..fb3f827fa6d 100644 --- a/hertzbeat-manager/src/main/resources/define/app-coreos.yml +++ b/hertzbeat-manager/src/main/resources/define/app-coreos.yml @@ -115,6 +115,18 @@ params: required: false # hide param-true or false hide: true + # field-param field key + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +170,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +240,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +308,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +353,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +393,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +441,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +483,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -505,6 +525,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-debian.yml b/hertzbeat-manager/src/main/resources/define/app-debian.yml index 678fe46ba11..0a84e1069db 100644 --- a/hertzbeat-manager/src/main/resources/define/app-debian.yml +++ b/hertzbeat-manager/src/main/resources/define/app-debian.yml @@ -115,6 +115,17 @@ params: required: false # hide param-true or false hide: true + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +169,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +239,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +307,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +352,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +392,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +440,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +482,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps --no-headers -eo pid,%cpu,%mem,cmd --sort=-%cpu | head -n 10 | awk 'BEGIN {print "pid cpu_usage mem_usage command"} {print $1, $2, $3, $4}' @@ -505,6 +524,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps --no-headers -eo pid,%cpu,%mem,cmd --sort=-%mem | head -n 10 | awk 'BEGIN {print "pid cpu_usage mem_usage command"} {print $1, $2, $3, $4}' diff --git a/hertzbeat-manager/src/main/resources/define/app-euleros.yml b/hertzbeat-manager/src/main/resources/define/app-euleros.yml index 5f5d0163fc7..b0993db7335 100644 --- a/hertzbeat-manager/src/main/resources/define/app-euleros.yml +++ b/hertzbeat-manager/src/main/resources/define/app-euleros.yml @@ -115,6 +115,18 @@ params: required: false # hide param-true or false hide: true + # field-param field key + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +170,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +240,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +308,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +353,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +393,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +441,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +483,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -505,6 +525,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-freebsd.yml b/hertzbeat-manager/src/main/resources/define/app-freebsd.yml index 9a32d11b207..16624bbbcf0 100644 --- a/hertzbeat-manager/src/main/resources/define/app-freebsd.yml +++ b/hertzbeat-manager/src/main/resources/define/app-freebsd.yml @@ -115,6 +115,18 @@ params: required: false # hide param-true or false hide: true + # field-param field key + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +170,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -227,6 +241,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "dmesg | grep -i cpu | awk 'NR==1';sysctl hw.ncpu | awk '{print $2}';uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -291,6 +306,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: sysctl hw | egrep 'hw.(phys|user|real)' | awk '{print $2}';dmesg | grep memory | grep avail | awk '{print $4}'; @@ -338,6 +354,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -m | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -379,6 +396,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -420,6 +438,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-linux.yml b/hertzbeat-manager/src/main/resources/define/app-linux.yml index 3c7f96033f7..f92a5dbf22d 100644 --- a/hertzbeat-manager/src/main/resources/define/app-linux.yml +++ b/hertzbeat-manager/src/main/resources/define/app-linux.yml @@ -115,6 +115,17 @@ params: required: false # hide param-true or false hide: true + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +169,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +239,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +307,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +352,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +392,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +440,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +482,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -505,6 +524,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-opensuse.yml b/hertzbeat-manager/src/main/resources/define/app-opensuse.yml index 4a885478e63..ec081d1904e 100644 --- a/hertzbeat-manager/src/main/resources/define/app-opensuse.yml +++ b/hertzbeat-manager/src/main/resources/define/app-opensuse.yml @@ -115,6 +115,17 @@ params: required: false # hide param-true or false hide: true + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +169,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +239,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +307,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +352,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +392,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +440,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -m | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +482,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -505,6 +524,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-redhat.yml b/hertzbeat-manager/src/main/resources/define/app-redhat.yml index 0ac7fbc5f36..1b6749a67d2 100644 --- a/hertzbeat-manager/src/main/resources/define/app-redhat.yml +++ b/hertzbeat-manager/src/main/resources/define/app-redhat.yml @@ -115,6 +115,18 @@ params: required: false # hide param-true or false hide: true + # field-param field key + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +170,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +240,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +308,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +353,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +393,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +441,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +483,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -505,6 +525,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-rockylinux.yml b/hertzbeat-manager/src/main/resources/define/app-rockylinux.yml index eb52b1dd94e..9ee2b37bd1e 100644 --- a/hertzbeat-manager/src/main/resources/define/app-rockylinux.yml +++ b/hertzbeat-manager/src/main/resources/define/app-rockylinux.yml @@ -115,6 +115,18 @@ params: required: false # hide param-true or false hide: true + # field-param field key + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +170,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +240,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '/Model name/ {print $2}' | awk 'NR==1';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +308,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +353,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +393,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +441,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -m | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +483,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -505,6 +525,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 diff --git a/hertzbeat-manager/src/main/resources/define/app-ubuntu.yml b/hertzbeat-manager/src/main/resources/define/app-ubuntu.yml index eee22cadb82..b3230779a9a 100644 --- a/hertzbeat-manager/src/main/resources/define/app-ubuntu.yml +++ b/hertzbeat-manager/src/main/resources/define/app-ubuntu.yml @@ -115,6 +115,18 @@ params: required: false # hide param-true or false hide: true + # field-param field key + - field: privateKeyPassphrase + # name-param field display i18n name + name: + zh-CN: 密钥短语 + en-US: PrivateKey PassPhrase + # type-param field type(most mapping the html input type) + type: password + # required-true or false + required: false + # hide param-true or false + hide: true # collect metrics config list metrics: # metrics - basic, inner monitoring metrics (responseTime - response time) @@ -158,6 +170,8 @@ metrics: password: ^_^password^_^ # ssh private key privateKey: ^_^privateKey^_^ + # ssh private key passphrase + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ # ssh run collect script @@ -226,6 +240,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: "LANG=C lscpu | awk -F: '$1==\"Model name\" {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 2 | awk 'NR==4{print $15}'" @@ -293,6 +308,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}' @@ -337,6 +353,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}' @@ -376,6 +393,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}' @@ -423,6 +441,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}' @@ -464,6 +483,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -505,6 +525,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11 @@ -530,6 +551,7 @@ metrics: username: ^_^username^_^ password: ^_^password^_^ privateKey: ^_^privateKey^_^ + privateKeyPassphrase: ^_^privateKeyPassphrase^_^ timeout: ^_^timeout^_^ reuseConnection: ^_^reuseConnection^_^ script: sensors | grep "^Core\s[0-9\d+\:]" | awk '{print $3}' | sed "s/°C/\ /g" | awk '{ total += $1; count++ } END { print total/count }'