<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>HP-UX and Netsaint_statd</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Hi All,</FONT>
<BR><FONT SIZE=2>Looking for a bit of direction pointing...</FONT>
<BR><FONT SIZE=2>Not very familiar with PERL, and we are now using the netsaint_statd for Nagios monitoring, as it solved our problem with some machines not wanting to run the NRPE daemon...</FONT></P>
<P><FONT SIZE=2>However, we are having a little issue with HP-UX and disk space monitoring...</FONT>
<BR><FONT SIZE=2>Here is a snippet of our bdf -l output:</FONT>
</P>
<P><FONT SIZE=2>Filesystem kbytes used avail %used Mounted on</FONT>
<BR><FONT SIZE=2>/dev/vg00/lvol3 204800 54976 140468 28% /</FONT>
<BR><FONT SIZE=2>/dev/vg00/lvol1 83733 30841 44518 41% /stand</FONT>
<BR><FONT SIZE=2>/dev/vg00/lvol8 1228800 1002685 212144 83% /var</FONT>
<BR><FONT SIZE=2>/dev/vg00/lvol7 1228800 561770 625379 47% /usr</FONT>
<BR><FONT SIZE=2>/dev/vgdata02/lvol07</FONT>
<BR><FONT SIZE=2> 2048000 1144064 847501 57% /u15</FONT>
<BR><FONT SIZE=2>/dev/vgdata02/lvol06</FONT>
<BR><FONT SIZE=2> 4096000 3074152 957988 76% /u14</FONT>
<BR><FONT SIZE=2>/dev/vgdata02/lvol05</FONT>
<BR><FONT SIZE=2> 10240000 8400295 1724729 83% /u13</FONT>
</P>
<P><FONT SIZE=2>As you can see, all is well until we reach the /dev/vgdata02/lvol07 filesystem...</FONT>
<BR><FONT SIZE=2>Then, due to the length of the Filesystem name, bdf supplies the disk space info on the next line down... However, the netsaint_statd see's nothing past the Filesystem and decides there is no data, and supplies the first filesystem on the machine as output...</FONT></P>
<P><FONT SIZE=2>Any assistanmce appreciated!</FONT>
</P>
<P><FONT SIZE=2>Here is the PERL code used to retrieve the data:</FONT>
</P>
<P><FONT SIZE=2>sub disk</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> my $arg = shift;</FONT>
<BR><FONT SIZE=2> my ($disk, $avail, $capper, $mountpt);</FONT>
</P>
<P><FONT SIZE=2> open(DFOUTPUT,"$commandlist{$os}{dfcommand} |") || die;</FONT>
<BR><FONT SIZE=2> $_ = <DFOUTPUT>;</FONT>
<BR><FONT SIZE=2> DFCHECK: while($_ = <DFOUTPUT>)</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> if (/^([\w\/\:\.\-\=]*)\s*\d*\s*\d*\s*(\d*)\s*(\d*)\%\s*([\w\/\-]*)/)</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> $disk = $1;</FONT>
<BR><FONT SIZE=2> $avail = $2;</FONT>
<BR><FONT SIZE=2> $capper = $3;</FONT>
<BR><FONT SIZE=2> $mountpt = $4;</FONT>
<BR><FONT SIZE=2> last DFCHECK if ($disk =~ /$arg/);</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> if ($disk && $mountpt)</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> $capper = 100 - $capper;</FONT>
<BR><FONT SIZE=2> print Client "$disk $avail $capper $mountpt ";</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> else</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> print Client "not found";</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> ($disk,$avail,$capper,$mountpt) = undef;</FONT>
<BR><FONT SIZE=2> close(DFOUTPUT);</FONT>
<BR><FONT SIZE=2> }</FONT>
</P>
</BODY>
</HTML>