Skip to content

Instantly share code, notes, and snippets.

View jhrcz's full-sized avatar

Jan Horacek jhrcz

View GitHub Profile
@jhrcz
jhrcz / README.md
Last active October 1, 2016 17:08
This is a quick hack for generating part of /etc/hosts to be used with dnsmasq to provide vmid specific dns names for vms running on opennebula. vm with id 456 will have dns record 456.vms.mydomain.local pointing to correct IP. in my test environment, used for generating /etc/host (prepending /etc/hosts.template) from cron to feed dnsmasq ;o)

opennebula addon for dynamic per-vm dns names

this tool allows to have delegated dns domain to opennebula with dns names for every vm.

vm dns names with vmid look like 3456.vms.my.domain.int. additionaly, there are dns names based on vm name with truncated suffix with vmid. this has sideefect for vms with the same base name - it allow having round robin ballancing.

currently we use /etc/hosts.dnsmasq to not interferre with system /etc/hosts. using hosts file has some drawbacks, like nonexistent wildcards.

sample usage

@jhrcz
jhrcz / pidgin-latest-messages.sh
Created November 30, 2013 21:19
list latest messages in pidgin - whis is useful when new message notification window is accidentaly closed.
ls -l -d --time-style long-iso ~/.purple/logs/jabber/*/* | awk '{print $6 " " $7 " " $8 }' | sort | tail
@jhrcz
jhrcz / yum-updinfo-3.sh
Last active December 29, 2015 20:29
list version differences in package version for yum update
#!/bin/bash
# based on
# http://arstechnica.com/civis/viewtopic.php?f=16&t=1081335
echo \"package name\",\"current version\",\"update version\"
yum -q check-update| while read i
do
i=$(echo $i) #this strips off yum's irritating use of whitespace
if [ "${i}x" != "x" ]
@jhrcz
jhrcz / rpm-spec-git-diff-patch-symlink.txt
Created November 18, 2013 13:34
my hacky way for patching symlink to be a file with changed content with diff from git, applying in rpm spec
@jhrcz
jhrcz / kvm-clock-hardsync.sh
Last active December 26, 2015 10:39
kvm-clock-hardsync.sh
#!/bin/bash
# /usr/local/sbin/kvm-clock-hardsync.sh
# cron:
# * * * * * /usr/bin/cronic /usr/local/sbin/kvm-clock-hardsync.sh
#
[ "$DEBUG" = "YES" ] \
&& set -x
@jhrcz
jhrcz / etn-opennebula-state-2013.md
Last active December 23, 2015 21:19
etn-opennebula-state-2013

one1c (ETN One Cloud #1) overview 2013

  • opennebula 3.2.1, preparing for upgrade to 4.x (requires migrating gfs2clvm close to upstream lvm driver, renaming all lvm names )

architecture

  • 8 viritualisation nodes (one1-host-X )
@jhrcz
jhrcz / nginx-satisfy-any-remoteaddr-clientcert
Last active December 23, 2015 11:00
nginx-satisfy-any-remoteaddr-clientcert
# satisfy any like funkcionality in nginx
# with client certificat or remote address
#
# based on https://sys-notes.com/bin/view/Main/NginxSSLClientAuth
#
#if ($ssl_client_s_dn !~ "(O=My Company)") {
# return 403;
#}
set $accessok "";
@jhrcz
jhrcz / kvm-force-blkio-throttle.sh
Last active December 4, 2017 12:00
force cpu and blkio thottle of kvm guests
#!/bin/bash
cat /cgroup/blkio/libvirt/qemu/blkio.throttle.read_bps_device
cat /cgroup/blkio/libvirt/qemu/blkio.throttle.write_bps_device
cat /cgroup/blkio/libvirt/qemu/*/blkio.throttle.read_bps_device
cat /cgroup/blkio/libvirt/qemu/*/blkio.throttle.write_bps_device
# 10MBps
#BPSLIMIT=10485760
@jhrcz
jhrcz / README.md
Last active December 19, 2015 00:09
nagios check_cluster generator

nagios check_cluster generator v2

why

  • minimize manual configuration
  • minize notifications from cluster hosts when clustered services are all down (notify only from new fake cluster host)

use

attic