Skip to content

Instantly share code, notes, and snippets.

@vps2fast
vps2fast / openvz_swap_usage.pl
Last active Feb 21, 2021
openvz_swap_usage.pl
View openvz_swap_usage.pl
#!/usr/bin/perl
use strict;
use warnings;
###
### Скрипт для подсчета места, забитого контейнерами в swap
###
my @containers = get_running_containers_list();
@vps2fast
vps2fast / check_sparse.pl
Created Oct 3, 2014
Script for detecting sparsed files
View check_sparse.pl
#!/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 / gist:56183fa775633383da50
Created Oct 1, 2014
unregister_netdevice: waiting for lo
View gist:56183fa775633383da50
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
@vps2fast
vps2fast / pfcache_statistics.pl
Last active Feb 21, 2021
Script for analyze pfcache effectiveness
View pfcache_statistics.pl
#!/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;
View gist:5428aa4acc6e4d9c25b7
/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
@vps2fast
vps2fast / gist:9089212
Created Feb 19, 2014
Script for OpenvVSwhich support in OpenVZ
View gist:9089212
#!/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')