INT 21h

Hi, I am Vladimir Smagin, SysAdmin, DevOps and barely good guy. Telegram Email / GIT / Микроблог / Thingiverse / GPG

Zabbix calculated item and abschange (change)

№ 10168 В разделе "Администрирование" от August 9th, 2019,

Last time I wrote to you how monitor your Nginx instance with Zabbix. Now I tell you how to calculate rates from counters.

You looking at something like that in your template

Now create new Item handled

Ok, see at field with formula, it linked with created earlier Item “Nginx Handled”. As said in official documentation abschange shows you a difference between last and current values. Now set Interval to 60 seconds and you have “Handled per minute” value.

Of course, you want to create some Graphics. All people loves graphics!

Нет комментариев »

Splash: how to change user-agent with Lua in Bash

№ 10157 В разделах: Администрирование Программирование от August 3rd, 2019,

Before start install jq application, required to work with JSON, used to prepare lua script for sending to Splash API.

Create file named splash.lua

function main(splash, args)
  splash:set_user_agent('Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11 Safari/525.20')
  splash:set_viewport_size(800, 600)
  splash:go('https://www.whatismybrowser.com/')
  splash:wait(0.5)
  return splash:png()
end

Create bash script run.sh

#!/bin/bash

JSON="{\"lua_source\":$(jq -Rs . < script.lua)}"

curl -s -X POST -H "Content-Type: application/json" -d "${JSON}" \
   "http://192.168.1.9:5009/execute" -o out.png

Check result image

Нет комментариев »

HELM: generate certs for all hosts in ingress.tls

№ 10106 В разделе "Администрирование" от July 1st, 2019,

{{- if .Values.ingress.tls }}
  {{- range .Values.ingress.tls }}
      {{- $secretName := .secretName -}}
      {{- range .hosts }}
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
  name: {{ $fullName }}
spec:
  acme:
    config:
    - dns01:
        provider: route53
      domains:
      - {{ . }}
  commonName: ""
  dnsNames:
  - {{ . }}
  issuerRef:
    kind: ClusterIssuer
    name: letsencrypt
  secretName: {{ $secretName }}
    {{- end }}
  {{- end }}
{{- end }}

Нет комментариев »

Autocleaning docker registry

№ 10098 В разделе "Администрирование" от June 25th, 2019,

To remove old images (in my case images can’t be older 14 days) I used https://github.com/andrey-pohilko/registry-cli and included registry tools to collect garbage.

Make sure you run your registry with REGISTRY_STORAGE_DELETE_ENABLED=true

docker run -d -p 127.0.0.1:5000:5000 -e "REGISTRY_STORAGE_DELETE_ENABLED=true" --restart always \
  --name docker-images-registry \
  -v /srv/registry/data:/var/lib/registry \
  -v /srv/registry/users:/auth/htpasswd registry:2

Now you can delete images

docker run --rm --link docker-images-registry anoxis/registry-cli \
  -r http://docker-images-registry:5000 --delete --keep-by-hours 336 \
  --keep-tags-like latest --digest-method=GET

Ok, use garbage collector

docker stop docker-images-registry

docker run --rm -v /srv/registry/data:/var/lib/registry \
  -v /srv/registry/users:/auth/htpasswd registry:2 \
  bin/registry garbage-collect /etc/docker/registry/config.yml

docker start docker-images-registry

Well done! Take a donut from a shelf.

Нет комментариев »

Микроблог перейти

# 2019-09-12 07:54:26

git.apache.org все еще не работает, но можно фиксануть go mod с помощью replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5

# 2019-09-10 13:58:22

офигенное хранилище абсолютно бесплатных svg www.svgrepo.com/

# 2019-09-09 16:29:21

Цикл статей тщательно разжевывающих Amazon IAM, очень рекомендую для прочтения medium.com/@thomas.storm/aws-i medium.com/@thomas.storm/aws-i medium.com/@thomas.storm/aws-i medium.com/@thomas.storm/aws-i


© Vladimir Smagin, 2005-2019. Копирование материалов без разрешения запрещено. GPG DA4CD0F5E222EA727D6A40C413BCE12E5618F071 *
Яндекс.Метрика

Fortune cookie: confusion, n: Father's Day in San Francisco.