Skip to content

Instantly share code, notes, and snippets.

@f41gh7
f41gh7 / README.md
Last active January 15, 2026 13:55
vmbackup as kubernetes sidecar

Snippets show example how to use vmbackup as kubernetes sidecar

Build image with cron

# copy or download dockerfile
wget  https://gist.githubusercontent.com/f41gh7/98ad3323cbdd46476595b6a8b753cce9/raw/83df07d56bf36cdba019e6663ee77c1e1649a7a1/cron-vmbackup.Dockerfile

# edit args for your vmbackup config at docker file
@f41gh7
f41gh7 / api-server.yaml
Last active January 8, 2026 15:47
vm operator configuration examples
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
name: apiserver
namespace: monitoring-system
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
bearerTokenSecret:
key: ""
@f41gh7
f41gh7 / all-in-one.yaml
Created April 11, 2025 14:14
VictoriaLogs cluster
apiVersion: v1
kind: Service
metadata:
name: vlinsert
spec:
type: ClusterIP
ports:
- name: http
protocol: TCP
port: 9428
@f41gh7
f41gh7 / gist:5d9f2dbae53163bdc0ebd1ada455b8d5
Created February 13, 2025 16:10
vmagent shard UI expose
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAgent
metadata:
name: main
spec:
selectAllByDefault: true
replicaCount: 1
statefulMode: true
shardCount: 2
extraArgs:
@f41gh7
f41gh7 / victoria_metrics_push_gw.py
Created January 17, 2021 02:08
VictoriaMetrics as push gateway.
from prometheus_client import Counter, start_http_server
from threading import Thread
import requests as re
import time
JOB_NAME = 'test'
INSTANCE = 'localhost'
def scrape_and_send(local_url: str, vm_url: str, scrape_interval: int):
@f41gh7
f41gh7 / README.md
Last active August 19, 2024 14:43
multi level vmcluster with helm chart

Mutli level cluster setup

doc

Lets say we have 2 zones: zone-a and zone-b. Separate cluster must be deploy to the both zones with commands:

helm upgrade -i zone-a vm/victoria-metrics-cluster -f zone.yaml
@f41gh7
f41gh7 / README.md
Last active August 12, 2024 18:18
VictoriaMetrics OTLP push

golang web app with opentelemetry metrics

Example of web-go application.

It could push collected metrics by http with opentelemetry insturmentation.

usage:

  1. build:
@f41gh7
f41gh7 / README.md
Last active July 30, 2024 13:46
metricsql.py

python wrapper for metricsql expr validation.

usage:

  1. build shared lib: go build -buildmode=c-shared -o library.so main.go
  2. use it
python3 metricsql.py 'not_exist(up)'`
failed to parse expr: not_exist(up), error: unsupported function "not_exist"
@f41gh7
f41gh7 / README.md
Created July 29, 2024 12:10
VMAlertmanager and helm

Recommeneded project structure for alertmanager helm chart

I'd recommend to keep project structure simple and straight forward:

chart-name/
  # any static content to include into templates
  files/
  # all needed dynamic templates
  templates/
@f41gh7
f41gh7 / README.md
Last active June 8, 2024 18:09
opentelemetry-collector and VM

How to use opentelemetry collector with VictoriaMetrics

requirements

Installation of VictoriaMetrics

In education purpose, I'll use single node version of VictoriaMetrics.