napsty / check_lxc Goto Github PK
View Code? Open in Web Editor NEWMonitoring plugin to check LXC (Linux Container)
License: GNU General Public License v2.0
Monitoring plugin to check LXC (Linux Container)
License: GNU General Public License v2.0
OS: Ubuntu 18.04.1 LTS
LXC: 3.0.2
Check doesn't work since the last updates:
Error:
/usr/lib/nagios/plugins/check_lxc.sh: line 253: + : syntax error: operand expected (error token is "+ ")
Hi, I'm running check_lxc on a Proxmox server. I haven't updated the system for some time. But I've updated the Proxmox server today and since then, check_lxc fails:
# LANG=C /usr/local/bin/check_lxc -n 509 -t mem
/usr/local/bin/check_lxc: line 157: 0 * 100 / : syntax error: operand expected (error token is "/ ")
Lines 156 and 157 are:
limit=$(lxc-cgroup -n ${container} memory.limit_in_bytes)
used_perc=$(( $used * 100 / $limit))
Unfortunately, lxc-cgroup is returning no result. So this is the reason why check_lxc fails.
But I don't have a clue so far what's wrong with the lxc-cgroup command...
Kind regards,
Bernd
The mem check doesn't work on Ubuntu when the recently added "cgroup_active" is used. Ubuntu seems to have cgroup support enabled by default without having to manually enable it as kernel boot parameter:
./check_lxc.sh -n mylxc -t mem -w 90 -c 93
cgroup is not defined as kernel boot parameter
cmdline does not contain a cgroup entry:
cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.2.0-38-generic root=/dev/mapper/vgroot-lvroot ro
But lxc-cgroup works:
lxc-cgroup -n mylxc memory.memsw.limit_in_bytes
8589934592
Hi
Host PC have 8 cpus. so i set cpu number 2 in container.
lxc-cgroup -n name cpuset.cpus 2
and i made cpu load 100 % in container. comand is below.
dd if=/dev/zero of=/dev/null
and run the check_lxc.
./check_lxc.sh -n name -t cpu
but result is CPU Usage: 52%.
I think the result should be 100 %..
Requirements Memory, Command wrong
"cat /etc/cgroups | grep memory"
should imho be:
'cat /proc/cgroups | grep memory'
(i'm running a debian-based system, maybe it's different on other distributions )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.