-
Notifications
You must be signed in to change notification settings - Fork 7
/
proxmox_qemu_backup
executable file
·46 lines (38 loc) · 1.29 KB
/
proxmox_qemu_backup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
# Author: Matthias Maderer
# E-Mail: edvler@edvler-blog.de
# URL: https://github.com/edvler/check_mk_proxmox-qemu-backup
# License: GPLv2
QEMU_SERVER_DIR=/etc/pve/qemu-server
LXC_SERVER_DIR=/etc/pve/lxc
VZDUMP_LOG_DIR=/var/log/vzdump
echo '<<<proxmox_qemu_backup>>>'
#get all proxmox qemu machines
QEMU_MACHINES=$(find $QEMU_SERVER_DIR/ -type f)
for qemu in $QEMU_MACHINES; do
QEMU_VMID=$(basename $qemu | cut -d '.' -f 1)
QEMU_MACHINE_NAME=$(cat $qemu|grep name:|awk '{print $2}')
if [ -z "$QEMU_MACHINE_NAME" ]; then
QEMU_MACHINE_NAME="NO-NAME"
fi
echo "QEMU-MACHINE;;;;;$qemu;;;;;$QEMU_MACHINE_NAME"
awk '{print FILENAME, $0}' ${VZDUMP_LOG_DIR}/qemu-${QEMU_VMID}.log \
| grep -v "INFO: status:"
done
###now lxc
echo '<<<proxmox_lxc_backup>>>'
# LXC
LXC_MACHINES=$(find $LXC_SERVER_DIR/ -type f)
for lxc in $LXC_MACHINES; do
LXC_VMID=$(basename $lxc | cut -d '.' -f 1)
LXC_MACHINE_NAME=$(cat $lxc|grep name:|awk '{print $2}')
if [ -z "$LXC_MACHINE_NAME" ]; then
LXC_MACHINE_NAME="NO-NAME"
fi
echo "LXC-MACHINE;;;;;$lxc;;;;;$LXC_MACHINE_NAME"
awk '{print FILENAME, $0}' ${VZDUMP_LOG_DIR}/lxc-${LXC_VMID}.log \
| grep -v "INFO: status:"
done
#Running processes
psout=$(ps aux |grep vzdump |grep /bin/sh)
echo "PSOUTPUT $psout"