Skip to content

Instantly share code, notes, and snippets.

View kvaps's full-sized avatar
🔳
This mess is mine!

Andrei Kvapil kvaps

🔳
This mess is mine!
View GitHub Profile
#!/bin/bash
# onevm monitoring for zabbix script
case $1 in
a* ) echo $(onevm list -l STAT | tail -n +2 | wc -l) ;;
r* ) echo $(onevm list -l STAT | tail -n +2 | grep 'runn\|boot' | wc -l) ;;
su* ) echo $(onevm list -l STAT | tail -n +2 | grep 'susp\|save' | wc -l) ;;
st* ) echo $(onevm list -l STAT | tail -n +2 | grep -v 'runn\|susp\|save\|boot\|err\|fail' | wc -l) ;;
e* ) echo $(onevm list -l STAT | tail -n +2 | grep 'err\|fail' | wc -l) ;;
* ) echo Need argument!; exit 1 ;;
#!/bin/bash
CONTAINERS=($(docker ps | awk '{if(NR>1) print $NF}' | grep '_kolab_' ))
ACMESH_URL="https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh"
for i in ${CONTAINERS[@]}; do
echo
echo processing $i container:

Proxmox 4.4

sed -i.bak "s/data.status !== 'Active'/false/g" \
   /usr/share/pve-manager/js/pvemanagerlib.js \
   /usr/share/pve-manager/touch/pvemanager-mobile.js

Watcher

@kvaps
kvaps / beegfs-rebuild.sh
Last active March 14, 2017 23:23
Script for build beegfs-client module for specified kernel
#!/bin/bash
LAST_KERNEL="$(ls -1h /lib/modules | tail -n1)"
KERNEL="${1:-$LAST_KERNEL}"
function finish {
mv /opt/beegfs/src/client/beegfs_client_module_6/build/Makefile{.bak,}
mv /etc/beegfs/beegfs-client-autobuild.conf{.bak,}
}
trap finish EXIT
wget http://repo.zabbix.com/zabbix/3.2/debian/pool/main/z/zabbix-release/zabbix-release_3.2-1+jessie_all.deb -O /tmp/zabbix-release_3.2-1+jessie_all.deb
dpkg -i /tmp/zabbix-release_3.2-1+jessie_all.deb
apt update
apt -y install zabbix-agent
sed -i 's/^# Timeout=3/# Timeout=3\n\nTimeout=10/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^Hostname=Zabbix server/#Hostname=Zabbix server/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^Server=127.0.0.1/Server=zabbix/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^ServerActive=127.0.0.1/ServerActive=zabbix/' /etc/zabbix/zabbix_agentd.conf
systemctl enable zabbix-agent
systemctl restart zabbix-agent
systemctl stop corosync
systemctl stop pve-cluster
pmxcfs -l
rm /etc/pve/corosync.conf
rm /etc/corosync/authkey
rm /etc/corosync/corosync.conf
#reboot the server
@kvaps
kvaps / iso_check.sh
Created May 10, 2017 08:57
OpenNebula iso check hook
#!/bin/bash
#IMAGE_HOOK = [
# name = "iso_check",
# on = "CREATE",
# command = "iso_check.sh",
# arguments = "$ID $TEMPLATE" ]
IMAGE_ID="$1"
TEMPLATE="$2"
$filter = "2k12R2\\amd64"
$drive = ((Get-WMIObject Win32_Volume | ? { $_.Label -like "virtio*" }).Name)
$drivers = (Get-ChildItem $drive -Filter *.inf -Recurse | % { $_.FullName } | Select-String $filter )
$drivers | %{pnputil -d $_ }
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
@kvaps
kvaps / proxmox-rename-vm.sh
Created June 16, 2017 15:42
Rename cm proxmox on ceph
#!/bin/bash
if [ -z $2 ]; then
echo "USAGE: $(basename $0) <oldid> <newid>"
exit 1
fi
if [ ! -f /etc/pve/*/${1}.conf ]; then
echo "vm or ct ${1} not found"
exit 2