Bon après-midiZabbix JMX article analyseur Regexp
J'ai un article dans Zabbix JMX:
JMX [ "MONITOR: type = hybride", Hybridinfo]
Cet article renvoie la chaîne de suivi
POOL: HYBRID-CHARGE.I8
Active: true
Carrier: TIM
Start Producer: true
Start Consumer: true
Configurations: null
CONSUMER
Consumer Threads: 23
Scheduled Tasks: 50
PRODUCER
Objects: 50000
Pagination Table: temporary.hybrid_engine_4
Pagination Interval: 60
Last Database Query: Fri May 12 14:23:32 UTC 2017
Last Result Size: 923526
Last Row Read: 923526
Seconds since Last Execution: 3
Je veux obtenir secondes depuis dernière exécution: 3 dans l'article comme
JMX [ "MONITOR: type = hybride", "Hybridinfo"] regexp. [(Secondes depuis la dernière exécution :). ([0-9] *) ,, \ 2])
Ou il serait à l'intérieur de la requête JMX comme:
JMX [ "MONITOR: type = hybride", "Hybridinfo." secondes depuis la dernière exécution: "]
le code de test pour l'élément JMX est au dessus.
#!/usr/bin/env bash
# Original source: https://www.zabbix.org/wiki/Docs/howto/zabbix_get_jmx
# Requires 'nc' app
ZBXGET="/usr/bin/zabbix_get"
if [ $# != 5 ] && [ $# != 7 ]; then
echo "Usage: $0 <JAVA_GATEWAY_HOST> <JAVA_GATEWAY_PORT> <JMX_SERVER> <JMX_PORT> <KEY> [<JMX_USER> <JMX_PASS>]"
exit;
fi
# Escape backslashes and double-quotes
KEYS=$(echo $5 | sed -e 's/\\/\\\\\\\\/g' -e 's/"/\\\"/g')
if [ $# = 5 ]; then
QUERY="{\"request\": \"java gateway jmx\",\"conn\": \"$3\",\"port\": $4,\"keys\": [\"${KEYS}\"]}"
else
JMX_USER="$6"
JMX_PASS="$7"
QUERY="{\"request\": \"java gateway jmx\",\"conn\": \"$3\",\"port\": $4,\"keys\": [\"${KEYS}\"],\"username\": \"${JMX_USER}\",\"password\": \"${JMX_PASS}\"}"
fi
# Prefix with binary header and length
QUERY_INTERPRETED=$(echo -en "${QUERY}")
QUERY_LEN=${#QUERY_INTERPRETED}
QUERY_LEN_BIN=$(printf "%.16x" ${QUERY_LEN} | sed "s/\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)/\\\x\8\\\x\7\\\x\6\\\x\5\\\x\4\\\x\3\\\x\2\\\x\1/")
QUERY_BIN="ZBXD\x01${QUERY_LEN_BIN}${QUERY}"
# Could not get zabbix_get 3.2.3 to work due to ZBX-11528 changes
# $ZBXGET -s $1 -p $2 -k "$QUERY"
echo -en "${QUERY_BIN}" | nc $1 $2
Je voudrais quelque chose comme cet objet: web.page.regexp [localhost, "/ vi/bilan de santé/API1", 3345, (HTTP /1.1).([0-9]*
Il ressemble beaucoup à cet article: web.page.regexp [localhost, "/ vi/health-check/api1", 3345, (HTTP/1.1). ([0-9] *) ,, \ 2] – Daniel
Comme mentionné, Zabbix ne supporte pas cela comme une fonctionnalité générique pour tous les types d'éléments - c'est une fonctionnalité venant dans Zabbix 3.4. – Richlv
@ Richlv Merci pour la réponse. – Daniel