lvm mit sudo

This commit is contained in:
Michael Grote 2021-06-16 12:11:26 +02:00
parent 227865d785
commit 29ddc8df58

10
lvm_
View file

@ -8,7 +8,7 @@ lvm_ - Wildcard plugin for monitoring disk usage on LVM. Each Volume Group is gr
=head1 CONFIGURATION
This plugin needs to run as the root user in order to have permission to run lvs and vgs
This plugin needs to run as the root user in order to have permission to run sudo lvs and vgs
[lvm_*]
user root
@ -48,8 +48,8 @@ EOF
if [ "$1" = "autoconf" ]; then
if ! command -v lvs >/dev/null; then
echo "no (lvs not found)"
if ! command -v sudo lvs >/dev/null; then
echo "no (sudo lvs not found)"
elif ! command -v vgs >/dev/null; then
echo "no (vgs not found)"
else
@ -79,7 +79,7 @@ if [ "$1" = "config" ]; then
echo 'graph_info This graph shows disk usage on the machine.'
echo "free.label free"
echo "free.draw AREA"
lvs --units b --nosuffix --noheadings | grep "$vg" | while read i; do
sudo lvs --units b --nosuffix --noheadings | grep "$vg" | while read i; do
name=`clean_name $i`
echo -n "$name.label "
echo $i | awk '{ print $1 }'
@ -92,7 +92,7 @@ i=`vgs --units b --nosuffix --noheadings | grep "$vg"`
echo -n "free.value "
echo $i | awk '{ print $7 }'
lvs --units b --nosuffix --noheadings | grep "$vg" | while read i; do
sudo lvs --units b --nosuffix --noheadings | grep "$vg" | while read i; do
name=`clean_name $i`
echo -n "$name.value "
echo $i | awk '{ print $4 }'