Saltar al contenido

Prometheus TIBCO Monitoring para Contenedores: ¡Rápido y Sencillo en 5 Minutos!

Prometheus se está convirtiendo en el nuevo estándar para la monitorización de Kubernetes y hoy vamos a cubrir cómo podemos hacer la monitorización de Prometheus TIBCO en Kubernetes.

Estamos viviendo en un mundo con cambios constantes y esto es aún más cierto en el mundo de las Aplicaciones Empresariales. No pasaré mucho tiempo hablando de cosas que ya conoces, pero solo diré que el enfoque de arquitectura de microservicios y las soluciones PaaS han sido un cambio de juego para todas las tecnologías de integración empresarial.

Esta vez me gustaría hablar sobre la monitorización y las capacidades de integración que tenemos al usar Prometheus para monitorear nuestros microservicios desarrollados bajo la tecnología TIBCO. Tampoco me gusta pasar demasiado tiempo hablando sobre qué es Prometheus, ya que probablemente ya lo sepas, pero en resumen, esta es una plataforma de monitorización distribuida de código abierto que ha sido el segundo proyecto lanzado por la Cloud Native Computing Foundation (después de Kubernetes en sí) y que se ha establecido como un estándar de facto de la industria para la monitorización de clústeres K8S (junto con otras opciones en el mercado como InfluxDB, etc.).

Prometheus tiene muchas características excelentes, pero una de ellas es que tiene conectores para casi todo y eso es muy importante hoy en día porque es tan complicado/no deseado/inusual definir una plataforma con un solo producto para la capa PaaS. Así que hoy, quiero mostrarte cómo monitorear tus aplicaciones de TIBCO BusinessWorks Container Edition usando Prometheus.

La mayor parte de la información que voy a compartir está disponible en el repositorio de GitHub bw-tooling, por lo que puedes ir allí si necesitas validar alguna declaración específica.

¿Ok, estamos listos? ¡¡Empecemos!!

Voy a asumir que ya tenemos un clúster de Kubernetes en su lugar y Prometheus instalado también. Entonces, el primer paso es mejorar la imagen base de BusinessWorks Container Edition para incluir la integración de capacidades de Prometheus. Para hacer eso, necesitamos ir a la página del repositorio de GitHub y seguir estas instrucciones:

  • Descargar y descomprimir la carpeta prometheus-integration.zip.
Monitorización de Prometheus TIBCO para Contenedores
  • Abrir TIBCO BusinessWorks Studio y apuntarlo a un nuevo espacio de trabajo.
  • Hacer clic derecho en Project Explorer → Importar… → seleccionar Plug-ins y Fragmentos → seleccionar el botón de radio Importar desde el directorio
  • Navegar a la carpeta prometheus-integration (descomprimida en el paso 1)
  • Ahora hacer clic en Siguiente → Seleccionar el plugin de Prometheus → hacer clic en el botón Agregar → hacer clic en Finalizar. Esto importará el plugin en el estudio.
  • Ahora, para crear el JAR de este plugin, primero necesitamos asegurarnos de actualizar com.tibco.bw.prometheus.monitor con ‘.’ (punto) en el campo Bundle-Classpath como se indica a continuación en el archivo META-INF/MANIFEST.MF.
  • Hacer clic derecho en Plugin → Exportar → Exportar…
  • Seleccionar tipo como archivo JAR y hacer clic en Siguiente
  • Ahora hacer clic en Siguiente → Siguiente → seleccionar el botón de radio para usar el archivo MANIFEST.MF existente y buscar el archivo manifest
  • Hacer clic en Finalizar. Esto generará prometheus-integration.jar

Ahora, con el JAR ya creado, lo que necesitamos hacer es incluirlo en tu propia imagen base. Para hacer eso, colocamos el archivo JAR en <TIBCO_HOME>/bwce/2.4/docker/resources/addons/jar

Y lanzamos el comando de construcción de imagen nuevamente desde la carpeta <TIBCO_HOME>/bwce/2.4/docker para actualizar la imagen usando el siguiente comando (usa la versión que estés usando en el momento)

docker build -t bwce_base:2.4.4 .

Entonces, ahora tenemos una imagen con soporte para Prometheus! ¡Genial! Estamos cerca del final, solo creamos una imagen para nuestra Aplicación de Contenedor, en mi caso, esto va a ser un servicio de eco muy simple que puedes ver aquí.

Y solo necesitamos mantener estas cosas en particular cuando desplegamos en nuestro clúster de Kubernetes:

  • Debemos establecer una variable de entorno con BW_PROMETHEUS_ENABLE en “TRUE”
  • Debemos exponer el puerto 9095 desde el contenedor para ser usado por Prometheus para integrar.

Ahora, solo necesitamos proporcionar este endpoint al sistema de scrapper de Prometheus. Hay varias maneras de hacer eso, pero nos vamos a centrar en la más simple.

Necesitamos cambiar el prometheus.yml para agregar los siguientes datos del trabajo:

- job_name: 'bwdockermonitoring'
  honor_labels: true
  static_configs:
    - targets: ['phenix-test-project-svc.default.svc.cluster.local:9095']
      labels:
        group: 'prod'

Y después de reiniciar Prometheus, tenemos todos los datos indexados en la base de datos de Prometheus para ser usados en cualquier sistema de panel de control.

En este caso, voy a usar Grafana para hacer un panel de control rápido.

Cada uno de estos componentes de gráfico está configurado en base a las métricas que están siendo extraídas por el exportador de Prometheus TIBCO.

Prometheus TIBCO Monitoring for Containers: Quick and Simple in 5 Minutes!

Prometheus is becoming the new standard for Kubernetes monitoring and today we are going to cover how we can do Prometheus TIBCO monitoring in Kubernetes.

We’re living in a world with constant changes and this is even more true in the Enterprise Application world. I’ll not spend much time talking about things you already know, but just say that the microservices architecture approach and the PaaS solutions have been a game-changer for all enterprise integration technologies.

This time I’d like to talk about monitoring and the integration capabilities we have of using Prometheus to monitor our microservices developed under TIBCO technology. I don’t like to spend too much time either talking about what Prometheus is, as you probably already know, but in a summary, this is an open-source distributed monitoring platform that has been the second project released by the Cloud Native Computing Foundation (after Kubernetes itself) and that has been established as a de-facto industry standard for monitoring K8S clusters (alongside with other options in the market like InfluxDB and so on).

Prometheus has a lot of great features, but one of them is that it has connectors for almost everything and that’s very important today because it is so complicated/unwanted/unusual to define a platform with a single product for the PaaS layer. So today, I want to show you how to monitor your TIBCO BusinessWorks Container Edition applications using Prometheus.

Most of the info I’m going to share is available in the bw-tooling GitHub repo, so you can get to there if you need to validate any specific statement.

Ok, are we ready? Let’s start!!

I’m going to assume that we already have a Kubernetes cluster in place and Prometheus installed as well. So, the first step is to enhance the BusinessWorks Container Edition base image to include the Prometheus capabilities integration. To do that we need to go to the GitHub repo page and follow these instructions:

  • Download & unzip the prometheus-integration.zip folder.
Prometheus TIBCO Monitoring for Containers
  • Open TIBCO BusinessWorks Studio and point it to a new workspace.
  • Right-click in Project Explorer → Import… → select Plug-ins and Fragments → select Import from the directory radio button
  • Browse it to prometheus-integration folder (unzipped in step 1)
  • Now click Next → Select Prometheus plugin → click Add button → click Finish. This will import the plugin in the studio.
  • Now, to create JAR of this plugin so first, we need to make sure to update com.tibco.bw.prometheus.monitor with ‘.’ (dot) in Bundle-Classpath field as given below in META-INF/MANIFEST.MF file.
  • Right-click on Plugin → Export → Export…
  • Select type as JAR file click Next
  • Now Click Next → Next → select radio button to use existing MANIFEST.MF file and browse the manifest file
  • Click Finish. This will generate prometheus-integration.jar

Now, with the JAR already created what we need to do is include it in your own base image. To do that we place the JAR file in the <TIBCO_HOME>/bwce/2.4/docker/resources/addons/jar

And we launch the building image command again from the <TIBCO_HOME>/bwce/2.4/docker folder to update the image using the following command (use the version you’re using at the moment)

docker build -t bwce_base:2.4.4 .

So, now we have an image with Prometheus support! Great! We’re close to the finish, we just create an image for our Container Application, in my case, this is going to be a very simple echo service that you can see here.

And we only need to keep these things in particular when we deploy to our Kubernetes cluster:

  • We should set an environment variable with the BW_PROMETHEUS_ENABLE to “TRUE”
  • We should expose the port 9095 from the container to be used by Prometheus to integrate.

Now, we only need to provide this endpoint to the Prometheus scrapper system. There are several ways to do that, but we’re going to focus on the simple one.

We need to change the prometheus.yml to add the following job data:

- job_name: 'bwdockermonitoring'
  honor_labels: true
  static_configs:
    - targets: ['phenix-test-project-svc.default.svc.cluster.local:9095']
      labels:
        group: 'prod'

And after restarting Prometheus we have all the data indexed in the Prometheus database to be used for any dashboard system.

In this case, I’m going to use Grafana to do quick dashboard.

Each of these graph components is configured based on the metrics that are being scraped by Prometheus TIBCO exporter.