Xymon Mailing List Archive search

Graphing a disk-like check

3 messages in this thread

list Nightwatch · Thu, 09 Feb 2017 14:38:42 +0100 ·
Hi all,

I'm trying to configure rrd graph for a check of a particular nfs mount
point on a linux client.

I'm aware that "df" command defined in the xymonclient-linux.sh script
excludes network disks and it's ok for me.
I'm executing a simple "df -P /NFS01" and sending to xymon server as
"vault" column name

output:

THU FEB 9 14:24:45 CET 2017

  Filesystem 1024-blocks Used Available Capacity Mounted on
nfs-server:/NFS01 13260711552 11019471040 2241240512 84% /nfs_01

configurations:

# ================================
# in the graphs.cfg I've duplicated the [disk] definition

[vault]
         FNPATTERN ^disk(.*).rrd
         TITLE Disk Utilization
         YAXIS % Full
         DEF:p at RRDIDX@=@RRDFN@:pct:AVERAGE
         LINE2:p at RRDIDX@#@COLOR@:@RRDPARAM@
         -u 100
         -l 0
         GPRINT:p at RRDIDX@:LAST: \: %5.1lf (cur)
         GPRINT:p at RRDIDX@:MAX: \: %5.1lf (max)
         GPRINT:p at RRDIDX@:MIN: \: %5.1lf (min)
         GPRINT:p at RRDIDX@:AVERAGE: \: %5.1lf (avg)\n


#==========================

#in the xymonserver.cfg I've wrote:

TEST2RRD=<standard stuff>,vault=ncv

I Have to add this line?
NCV_vault=????:GAUGE

In the detail page there no graph, and the rrd file reports NaN...

any suggestion is appreciated

max


Con Open 4 Giga a 9 euro/4 sett navighi veloce, chiami e invii SMS dal 
tuo smartphone verso tutti i fissi e mobili in Italia. Passa a Tiscali 
Mobile! http://casa.tiscali.it/mobile/
list Erik · Fri, 10 Feb 2017 08:41:34 -0600 ·
You're on the right track with the graphs.cfg and xymonserver.cfg

Your data has to be transmitted from the client as NCV, though.  Each data
point has to be sent on a line by itself in "name-colon-value" format.

Your message should look something like this:

data HOSTNAME.TESTNAME

blocks_used:3333333
blocks_available:4444444
blocks_size:7777777

See the manpage for the xymon command to send a "data" message":
https://www.xymon.com/help/howtograph.html
Go back and read the "Custom Graph" help page, too...
https://www.xymon.com/help/howtograph.html

Read all the way to the bottom and pay attention to how to send "trends"
data directly into a specific RRD file.  That might be particularly
helpful; I might even change a few of my custom data scripts based on that.

As an aside note... if it were me doing this-- trying to graph additional
disk data-- I would modify the OS specific client script (e.g.
/home/xymon/client/bin/xymonclient-linux.sh) to include the NFS file system
you interested in graphing.  Find where it executes "df -P" and replace
that with a custom script, e.g. /home/xymon/client/ext/custom_df.sh

In a normal client message, you'll see something like this:

[df]
Filesystem                   1024-blocks      Used Available Capacity Mounted on
/dev/mapper/vgroot-lvroot         774064      506600     228148      69% /
/dev/sda1                         126931       91273      29105      76% /boot
/dev/mapper/vgroot-lvhome         516040       17536     472292       4% /home
/dev/mapper/vgroot-lvopt         2064208      631884    1327468      33% /opt
/dev/mapper/vgroot-lvtmp         2064208       95144    1864208       5% /tmp
/dev/mapper/vgroot-lvusr         4902544     4284596     368924      93% /usr
/dev/mapper/vgroot-lvusrloc      1032088       95692     883968
10% /usr/local
/dev/mapper/vgroot-lvvar        10321208     6985600    2811424      72% /var
[inode]

Here's what that looks like in code:

echo "[df]"EXCLUDES=`cat /proc/filesystems | grep nodev | grep -v
rootfs | awk '{print $2}' | xargs echo | sed -e 's! ! -x !g'`
ROOTFS=`readlink -m /dev/root`
df -Pl -x iso9660 -x $EXCLUDES | sed -e '/^[^   ][^     ]*$/{
N
s/[     ]*\n[   ]*/ /
}' -e "s&^rootfs&${ROOTFS}&"
echo "[inode]"

Modify the code so it will give you the results you're expecting, to
include your NFS filesystem.  If the line is there, it will be graphed
just like the rest of them

[df]
Filesystem                   1024-blocks      Used Available Capacity Mounted on
/dev/mapper/vgroot-lvroot         774064      506600     228148      69% /
/dev/sda1                         126931       91273      29105      76% /boot
/dev/mapper/vgroot-lvhome         516040       17536     472292       4% /home
/dev/mapper/vgroot-lvopt         2064208      631884    1327468      33% /opt
/dev/mapper/vgroot-lvtmp         2064208       95144    1864208       5% /tmp
/dev/mapper/vgroot-lvusr         4902544     4284596     368924      93% /usr
/dev/mapper/vgroot-lvusrloc      1032088       95692     883968
10% /usr/local
/dev/mapper/vgroot-lvvar        10321208     6985600    2811424      72% /var
nfs-server:/NFS01            13260711552 11019471040 2241240512      84% /nfs01
[inode]

I know. I know. This probably REALLY violates standard Xymon
practices.  It certainly does add potential problems and maintenance
headaches down the road when you upgrade, but it is certainly the
shortest path to tracking your disk.  I've made a number of
modifications to my OS specific scripts in my environment over the
years.  When I upgrade, I diff the originals.  If they're the same, I
simply drop in my custom script.  If not, I have all the changes
documented at the top of my custom script so I can find them easier.

Good luck!
list Phil Crooker · Sun, 12 Feb 2017 22:43:54 +0000 ·
Nice hack with changing the definition of df. I normally just create a specific test - I just have to watch that there aren't too many tests for display on the webpage. I like your technique - much cleaner.


I don't think breaks the intent of xymon at all - those OS-level definitions are there so they can be easily modified. Much better than having to change the OS side!


Subject: Re: [Xymon] Graphing a disk-like check
quoted from Erik

You're on the right track with the graphs.cfg and xymonserver.cfg

Your data has to be transmitted from the client as NCV, though.  Each data point has to be sent on a line by itself in "name-colon-value" format.

Your message should look something like this:

data HOSTNAME.TESTNAME

blocks_used:3333333
blocks_available:4444444
blocks_size:7777777

See the manpage for the xymon command to send a "data" message": https://www.xymon.com/help/howtograph.html
Go back and read the "Custom Graph" help page, too... https://www.xymon.com/help/howtograph.html

Read all the way to the bottom and pay attention to how to send "trends" data directly into a specific RRD file.  That might be particularly helpful; I might even change a few of my custom data scripts based on that.

As an aside note... if it were me doing this-- trying to graph additional disk data-- I would modify the OS specific client script (e.g. /home/xymon/client/bin/xymonclient-linux.sh) to include the NFS file system you interested in graphing.  Find where it executes "df -P" and replace that with a custom script, e.g. /home/xymon/client/ext/custom_df.sh

In a normal client message, you'll see something like this:


[df]
Filesystem                   1024-blocks      Used Available Capacity Mounted on
/dev/mapper/vgroot-lvroot         774064      506600     228148      69% /
/dev/sda1                         126931       91273      29105      76% /boot
/dev/mapper/vgroot-lvhome         516040       17536     472292       4% /home
/dev/mapper/vgroot-lvopt         2064208      631884    1327468      33% /opt
/dev/mapper/vgroot-lvtmp         2064208       95144    1864208       5% /tmp
/dev/mapper/vgroot-lvusr         4902544     4284596     368924      93% /usr
/dev/mapper/vgroot-lvusrloc      1032088       95692     883968      10% /usr/local
/dev/mapper/vgroot-lvvar        10321208     6985600    2811424      72% /var
[inode]

Here's what that looks like in code:

echo "[df]"
EXCLUDES=`cat /proc/filesystems | grep nodev | grep -v rootfs | awk '{print $2}' | xargs echo | sed -e 's! ! -x !g'`
quoted from Erik
ROOTFS=`readlink -m /dev/root`
df -Pl -x iso9660 -x $EXCLUDES | sed -e '/^[^   ][^     ]*$/{
N
s/[     ]*\n[   ]*/ /
}' -e "s&^rootfs&${ROOTFS}&"
echo "[inode]"

Modify the code so it will give you the results you're expecting, to include your NFS filesystem.  If the line is there, it will be graphed just like the rest of them

[df]
Filesystem                   1024-blocks      Used Available Capacity Mounted on
/dev/mapper/vgroot-lvroot         774064      506600     228148      69% /
/dev/sda1                         126931       91273      29105      76% /boot
/dev/mapper/vgroot-lvhome         516040       17536     472292       4% /home
/dev/mapper/vgroot-lvopt         2064208      631884    1327468      33% /opt
/dev/mapper/vgroot-lvtmp         2064208       95144    1864208       5% /tmp
/dev/mapper/vgroot-lvusr         4902544     4284596     368924      93% /usr
/dev/mapper/vgroot-lvusrloc      1032088       95692     883968      10% /usr/local
/dev/mapper/vgroot-lvvar        10321208     6985600    2811424      72% /var
nfs-server:/NFS01            13260711552 11019471040 2241240512      84% /nfs01
[inode]

I know. I know. This probably REALLY violates standard Xymon practices.  It certainly does add potential problems and maintenance headaches down the road when you upgrade, but it is certainly the shortest path to tracking your disk.  I've made a number of modifications to my OS specific scripts in my environment over the years.  When I upgrade, I diff the originals.  If they're the same, I simply drop in my custom script.  If not, I have all the changes documented at the top of my custom script so I can find them easier.

Good luck!