Zabbix : Monitorando o Jboss Standalone / Keycloak SSO

No passado criei  um post para monitoração do Jboss domain via jboss cli no Zabbix , neste post será apresentado o mesmo template monitorando o ambiente em modo standalone .

Este template também pode ser utilizado para monitorar o Keycloak SSO e Redhat SSO.

http://www.keycloak.org/

 

 

Postagens anteriores sobre o tema :

Jboss : Script de Monitoração via CLI

 

Zabbix : Monitorando Instâncias do Jboss Domain

 

Ajustes necessários no agente do Zabbix :

UserParameter=JbossMonSTD[*],/bin/jboss_mon-standalone.sh $1 $2 $3

 

Template do Zabbix para download :

zabbix-jboss-standalone

 

 

Opções de execução do script :

HeapUsed – Heap Utilizada
HeapMax – Heap Máxima da JVM
PermgenUsed – Permgen Utilizado
PermgenMax – Permgen Máximo da JVM
ThreadsCount – Contagem de threads utilizadas por instância

 

Script :


#!/bin/bash

### VARIABLES ###
JCLI_HOME="/opt/jboss/bin"
JUSER_ADMIN=juser
JUSER_PASS=jpass
HOST=$(hostname)
MGMT_PORT=9990

case "$1" in

HeapUsed)
$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)" | grep "used" | awk '{print $3}' | sed 's/L,//'
#echo $HeapUsed
;;

HeapMax)
$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)" | grep "max" | awk '{print $3}' | sed 's/L//'
#echo $HeapMax
;;

HeapFree)
HeapMaxVar=`$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)" | grep "max" | awk '{print $3}' | sed 's/L//'`

HeapUsedVar=`$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)" | grep "used" | awk '{print $3}' | sed 's/L,//'`

HeapFreeVar=$((HeapMaxVar - HeapUsedVar))

echo $HeapFreeVar

;;

PermgenUsed)
$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=memory:read-attribute(name=non-heap-memory-usage)" | grep "used" | awk '{print $3}' | sed 's/L,//'
#echo $PermgenUsed
;;

PermgenMax)
$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=memory:read-attribute(name=non-heap-memory-usage)" | grep "max" | awk '{print $3}' | sed 's/L//'
#echo $PermgenMax
;;

PermgenFree)
PermgenMaxVar=`$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=memory:read-attribute(name=non-heap-memory-usage)" | grep "max" | awk '{print $3}' | sed 's/L//'`

PermgenUsedVar=`$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=memory:read-attribute(name=non-heap-memory-usage)" | grep "used" | awk '{print $3}' | sed 's/L,//'`

PermgenFreeVar=$((PermgenMaxVar - PermgenUsedVar))
echo $PermgenFreeVar
;;

 

ThreadsCount)
$JCLI_HOME/jboss-cli.sh --connect --controller=${HOST}:${MGMT_PORT} --user=${JUSER_ADMIN} --password=${JUSER_PASS} --commands="/core-service=platform-mbean/type=threading:read-resource(include-runtime=true)" | grep '"thread-count"' | awk '{print $3}' | sed 's/,//'
#echo $ThreadsCount
;;

 

*)
echo "Exemplo de utilizacao : ./jboss-mon <OPTION>"
echo "Utilize as opcoes (HeapUsed | HeapMax | PermgenUsed | PermgenMax | PermgenFree | ThreadsCount)"
esac

 

 

Validação do ambiente :