How to check application monitoring

Build the image and deploy demo-app, Service and VMServiceScrape.

When application monitoring is configured on a cluster, you can check its operation using any application with metrics in the OpenMetrics format. The instructions use a demo application from VictoriaMetrics.

Before checking, make sure that application requirements are met and VMSingle and VMAgent are deployed in user-monitoring - see application monitoring setup.

What is created in demo-app

ObjectNamespacePurpose
Namespace—demo-app
Deploymentdemo-appDemo app with metrics
Servicedemo-appAccess to metrics endpoint
VMServiceScrapedemo-appVMAgent metrics collection rule from user-monitoring

Prerequisites

  • host/machine/computer with git and docker installed - for downloading sources and building the demo-app image;
  • local or public registry for publishing the assembled image:
    • in a closed loop — local mirror (for example, mirror.shturval.local);
    • in an open loop — for example, hub.docker.com.

Step 1. Create namespace demo-app

In the cluster GUI, open Namespaces and create demo-app for the VictoriaMetrics demo application.

Screenshot

Screenshot in the platform GUI

Step 2. Build and publish the image

From the CLI, clone the repository, build the image, and push it to your registry:

Example:

git clone https://github.com/VictoriaMetrics/demo-app
cd demo-app/
REGISTRY=<YOUR VALUE> TAG=<YOUR VALUE> make docker-push
ParameterDescriptionData typeExample
REGISTRYLocal or public Registrystringmirror.shturval.local
TAGDemo application build versionstring1.2

Step 3: Deploy the application and VMServiceScrape

In the GUI, using import manifests, import Deployment, Service and VMServiceScrape into the cluster in the demo-app namespace without changing the parameters (except for the image in Deployment - specify the registry and tag from step 2):

  1. Deployment demo-app - container with the demo-app image;
  2. Service demo-app — port http for scrape;
  3. VMServiceScrape demo-app-service-scrape - metrics collection rule for VMAgent.

Example manifests:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-app
  namespace: demo-app
  labels:
    app.kubernetes.io/name: demo-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: demo-app
  template:
    metadata:
      labels:
        app.kubernetes.io/name: demo-app
    spec:
      containers:
        - name: app
          image: r.shturval.tech/victoriametrics/demo-app:1.2 # replace with your REGISTRY/TAG from step 2
---
apiVersion: v1
kind: Service
metadata:
  name: demo-app
  namespace: demo-app
  labels:
    app.kubernetes.io/name: demo-app
spec:
  selector:
    app.kubernetes.io/name: demo-app
  ports:
    - port: 8080
      name: http
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
  name: demo-app-service-scrape
  namespace: demo-app
spec:
  endpoints:
    - port: http
  selector:
    matchLabels:
      app.kubernetes.io/name: demo-app
Screenshot

Screenshot in the platform GUI

Check

After deployment, demo-app metrics should appear in the selected storage (local VMSingle in user-monitoring or external remoteWrite).