Сервис для сбора метрик в формате Prometheus из сервиса snipe-it

Snipeit-exporter

Сервис для сбора метрик в формате Prometheus из сервиса snipe-it

Язык разработки:

  • Go

Использование и конфигурирование сервиса

В проекте для сборки docker-образа используется скрипт build.sh Скрипт может принимать аргументы:

./build.sh 
   

   

При запуске скрипта без аргументов формируется образ с именем snipeit-exporter

Сервис конфигурируется через файл. Конфигурация сервиса по умолчанию берется из файла config.yml в рабочей директории или путь к конфигурации указывается в переменной окружения APP_CONFIG_PATH=/, пример: export APP_CONFIG_PATH=/app/config.yml

Имена метрик и фильтры по которым идёт отбор метрик задаются в файле конфигурации.

Пример конфигурации:

# Указание порта и пути по которым отдаются метрики
addr: ":80"
metricspath: "/metrics"

# Указание параметров подключения к сервису snipe-it
snipeit:
  url: http://snipeit.local
  apikey: key123

# Под ключами filters и metrics настраивается формирование метрик
# filters создает фильтр по которому идет отбор полей для метрик
  filters: 
    category_ext_test_server:
      field: "category.name"
      value: "external test server"
      
    category_storage:
      field: "category.name"
      value: "storage system"
    
    environment_test:
      field: "custom_fields.environment.value"
      value: "test"      
  
  metrics: 
    - fqName: cap_asset_memory_bytes_total
      help: description of the metric
      labels:
        - name: "environment"
          value: "custom_fields.environment.value"
        - name: "customer"
          value: "custom_fields.customer.value"
        - name: "model"
          value: "model.name"
      value: "custom_fields.ram.value"
      # ratio указывается соотношение(множитель) на который умножается значение из snape-it
      ratio: 1073741824
      # filternames список списков с фильтрами которые применяются к выборке из snape-it для формирования метрик
      # вертикальный элемент списка действует как логическое ИЛИ, горизонтальный как И 
      filternames:
      - ["category_ext_test_server", "environment_test"]

    - fqName: cap_asset_cpu_total
      help: description of the metric
      labels:
        - name: "environment"
          value: "custom_fields.environment.value"        
        - name: "customer"
          value: "custom_fields.customer.value"
        - name: "model"
          value: "model.name"
      value: "custom_fields.cpu.value"
      filternames:
      - ["category_ext_test_server", "environment_test"]

    - fqName: cap_asset_disk_gbytes_total
      help: description of the metric
      labels:
        - name: "environment"
          value: "custom_fields.environment.value"        
        - name: "customer"
          value: "custom_fields.customer.value"
        - name: "model"
          value: "model.name"
      value: "custom_fields.available_disk_space.value"
      ratio: 1024
      filternames:
      - ["category_storage", "environment_test"]

Разворачивание сервиса в кластере

В проекте есть директория helm для разворачивания сервиса в кластере kubernetes/openshift с помощью утилиты helm.

Similar Resources

🦥 Easy and simple Prometheus SLO generator

🦥 Easy and simple Prometheus SLO generator

Sloth Introduction Use the easiest way to generate SLOs for Prometheus. Sloth generates understandable, uniform and reliable Prometheus SLOs for any k

Jan 4, 2023

Prometheus rule linter

pint pint is a Prometheus rule linter. Usage There are two modes it works in: CI PR linting Ad-hoc linting of a selected files or directories Pull Req

Jan 2, 2023

Prometheus exporter for Chia node metrics

chia_exporter Prometheus metric collector for Chia nodes, using the local RPC API Building and Running With the Go compiler tools installed: go build

Sep 19, 2022

Plays videos using Prometheus, e.g. Bad Apple.

Plays videos using Prometheus, e.g. Bad Apple.

prom_bad_apple Plays videos using Prometheus, e.g. Bad Apple. Inspiration A while back I thought this blog post and the corresponding source code were

Nov 30, 2022

k6 prometheus output extension

xk6-prometheus A k6 extension implements Prometheus HTTP exporter as k6 output extension. Using xk6-prometheus output extension you can collect metric

Nov 22, 2022

Generate Prometheus rules for your SLOs

prometheus-slo Generates Prometheus rules for alerting on SLOs. Based on https://developers.soundcloud.com/blog/alerting-on-slos. Usage Build and Run

Nov 27, 2022

Nvidia GPU exporter for prometheus using nvidia-smi binary

Nvidia GPU exporter for prometheus using nvidia-smi binary

nvidia_gpu_exporter Nvidia GPU exporter for prometheus, using nvidia-smi binary to gather metrics. Introduction There are many Nvidia GPU exporters ou

Jan 5, 2023

NVIDIA GPU metrics exporter for Prometheus leveraging DCGM

DCGM-Exporter This repository contains the DCGM-Exporter project. It exposes GPU metrics exporter for Prometheus leveraging NVIDIA DCGM. Documentation

Dec 27, 2022

Prometheus exporter for Amazon Elastic Container Service (ECS)

ecs_exporter 🚧 🚧 🚧 This repo is still work in progress and is subject to change. This repo contains a Prometheus exporter for Amazon Elastic Contai

Nov 27, 2022
Dec 14, 2021
Производственный календарь России для go

GO производственный календарь Пакет проверяет признак праздника/рабочего дня на заданную дату, набор данных предоставлен Порталом открытых данных Минэ

Jan 16, 2022
Export Prometheus metrics from journald events using Prometheus Go client library

journald parser and Prometheus exporter Export Prometheus metrics from journald events using Prometheus Go client library. For demonstration purposes,

Jan 3, 2022
Translate Prometheus Alerts into Kubernetes pod readiness

prometheus-alert-readiness Translates firing Prometheus alerts into a Kubernetes readiness path. Why? By running this container in a singleton deploym

Oct 31, 2022
A beginner friendly introduction to prometheus 🔥
A beginner friendly introduction to prometheus 🔥

Prometheus-Basics A beginner friendly introduction to prometheus. Table of Contents What is prometheus ? What are metrics and why is it important ? Ba

Dec 29, 2022
Doraemon is a Prometheus based monitor system
Doraemon is a Prometheus based monitor system

English | 中文 Doraemon Doraemon is a Prometheus based monitor system ,which are made up of three components——the Rule Engine,the Alert Gateway and the

Nov 28, 2022
A set of tests to check compliance with the Prometheus Remote Write specification

Prometheus Remote Write Compliance Test This repo contains a set of tests to check compliance with the Prometheus Remote Write specification. The test

Dec 4, 2022
Automating Kubernetes Rollouts with Argo and Prometheus. Checkout the demo URL below
Automating Kubernetes Rollouts with Argo and Prometheus. Checkout the demo URL below

observe-argo-rollout Demo for Automating and Monitoring Kubernetes Rollouts with Argo and Prometheus Performing Demo The demo can be found on Katacoda

Nov 16, 2022
📡 Prometheus exporter that exposes metrics from SpaceX Starlink Dish
📡  Prometheus exporter that exposes metrics from SpaceX Starlink Dish

Starlink Prometheus Exporter A Starlink exporter for Prometheus. Not affiliated with or acting on behalf of Starlink(™) ?? Starlink Monitoring System

Dec 19, 2022
A tool to dump and restore Prometheus data blocks.
A tool to dump and restore Prometheus data blocks.

promdump promdump dumps the head and persistent blocks of Prometheus. It supports filtering the persistent blocks by time range. Why This Tool When de

Dec 16, 2022