Skip to content

Instantly share code, notes, and snippets.

@vps2fast
vps2fast / gist:9089212
Created February 19, 2014 10:07
Script for OpenvVSwhich support in OpenVZ
#!/bin/sh
#
# Add virtual network interfaces (veth's) in a container to a bridge on CT0
# Manual: http://openvz.org/Virtual_Ethernet_device#Automating_the_bridge
CONFIGFILE=/etc/vz/conf/$VEID.conf
. $CONFIGFILE
NETIFLIST=$(printf %s "$NETIF" |tr ';' '\n')
@vps2fast
vps2fast / check_sparse.pl
Created October 3, 2014 07:39
Script for detecting sparsed files
#!/usr/bin/perl
# based on: https://code.google.com/p/unixtoolbox/source/browse/trunk/sparse_files/checksparse.pl?r=8
# author: pavel.odintsov@gmail.com
use strict;
use warnings;
unless (scalar @ARGV == 1) {
die "Please specify path";
@vps2fast
vps2fast / pfcache_statistics.pl
Last active February 21, 2021 15:06
Script for analyze pfcache effectiveness
#!/usr/bin/perl
use strict;
use warnings;
# Pavel Odintsov odintsov@fastvps.ee
# License: GPLv2
my @pfcache_cache_contents = `find /vz/pfcache|sed 's#/vz/pfcache##'|sed 's#/##g'`;
chomp @pfcache_cache_contents;
@vps2fast
vps2fast / openvz_swap_usage.pl
Last active February 21, 2021 15:06
openvz_swap_usage.pl
#!/usr/bin/perl
use strict;
use warnings;
###
### Скрипт для подсчета места, забитого контейнерами в swap
###
my @containers = get_running_containers_list();
@vps2fast
vps2fast / gist:56183fa775633383da50
Created October 1, 2014 09:43
unregister_netdevice: waiting for lo
Oct 1 13:16:03 ovz36.fastvps.ru kernel: [13085703.689942] CT: 3647: checkpointed
Oct 1 13:16:13 ovz36.fastvps.ru [13085713.969692] unregister_netdevice: waiting for lo=ffff880250a95020 to become free. Usage count = 2758
Oct 1 13:16:13 ovz36.fastvps.ru [13085713.969696] ve=3647
Oct 1 13:16:13 ovz36.fastvps.ru kernel: [13085713.969692] unregister_netdevice: waiting for lo=ffff880250a95020 to become free. Usage count = 2758
Oct 1 13:16:23 ovz36.fastvps.ru
Oct 1 13:16:23 ovz36.fastvps.ru [13085724.013140] unregister_netdevice: waiting for lo=ffff880250a95020 to become free. Usage count = 2758
Oct 1 13:16:23 ovz36.fastvps.ru [13085724.013144] ve=3647
Oct 1 13:16:23 ovz36.fastvps.ru kernel: [13085713.969696] ve=3647
Oct 1 13:16:24 ovz36.fastvps.ru kernel: [13085724.013140] unregister_netdevice: waiting for lo=ffff880250a95020 to become free. Usage count = 2758
Oct 1 13:16:33 ovz36.fastvps.ru
/usr/bin/pfcache_statistics.pl
We loaded 188279 hashes from /vz/pfcache
Process 42381
We got 238 uniq memory mapped files
We have 231 cached in pfcache file in container
We save 201830550 bytes of memory in this container
Process 42982
We got 115 uniq memory mapped files
We have 114 cached in pfcache file in container
We save 178978719 bytes of memory in this container