🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #27808

Re: INN stats to MRTG

#27808
From: Jeff Liebermann
Date: Thu, 23 Apr 1998 00:00
92 lines
4215 bytes
On 21 Apr 1998 23:47:16 +0200, Stig Sandbeck Mathisen
<ssm@rlyeh.net> wrote:

>Ricardo Stella <stella@NO-SPAM.library.rider.edu> writes:
>> Has anyone done something similar ?
>> I would like to integrate stats to MRTG.
>> Thanks in advance.
>> inn 1.7.2+insync, Solaris 2.6, innreport
>
>MRTG just needs some numbers every five minutes, it should be easy (?)
>to make this in perl from a channel fed program (if you know perl, at
>least, I'm not that good yet), or from a program continuously tailing
>the logs.
>
>Then get MRTG to fetch that data every five minutes.
>(At least, in theory. :-)

It's easily done with a shell script and a bit of trashing.  I
built up a generalized shell script solution.  This monitors the
disk useage and inode useage for my news filesystem.  The shell
script can actually extract any INTEGER number and feed it to
MRTG in the manner shown.

The shell script that belches two numbers.  %used and %iused

-----------------------  Cut here ------------------------------
#!/bin/sh
# by Jeff Liebermann  04/15/98
#
# Get various diskspace numbers for MRTG.
#
# This is the format belched by df -v -i
# Mount Dir Filesystem  blocks used free %used iused ifree %iused
# /      /dev/root 1050000 972132  77868  93%  59872 71384   46%
# /stand /dev/boot   30000  16414  13586  55%     14  3746    1%
# /u     /dev/u     600000 252560 347440  43%   4259 70741    6%
# /usr/spool /dev/news 184492 5830 178662   4%      8 23056    1%
#
# Really disgusting way to get rid of extra leading spaces
# by feeding it to a shell variable.  Ugly at best.
#
# usage: whatever machine Filesystem
# i.e.   whatever comix /dev/root
#
retch=`rcmd $1 "df -v -i $2" | tail -1 | tr -d %` #News Filesys
set $retch	# break apart into fields using IFS seperators
echo $6		# Percentage diskspace used
echo $9		# Percentage inodes used
#


The section of mrtg.cfg that runs the rdf.sh script.  The
sub-directory "top" is a symlink to
/usr/local/etc/httpd/top-of-tree or wherever one locates the root
directory of their web server.  Note that the name of the
filesystem is specified as $2 and the name of the remote server
(comix) as $1.
-----------------------  Cut here ------------------------------
# News Disk Useage on comix
Target[rdf.4]: `/top/mrtg/bin/rdf.sh comix /dev/news`
Title[rdf.4]: Comix Disk Useage /dev/news
PageTop[rdf.4]: <H1>Comix Disk Useage /dev/news</H1>
Options[rdf.4]: growright, gauge, nopercent
MaxBytes[rdf.4]:100
# WithPeak[rdf.4]: dwmy
Unscaled[rdf.4]: dwmy
YLegend[rdf.4]: % Used
ShortLegend[rdf.4]: %
Legend1[rdf.4]: Avg Percent Diskspace Used
Legend2[rdf.4]: Avg Percent Inodes Used
# Legend3[rdf.4]:
# Legend4[rdf.4]:
LegendI[rdf.4]: Diskspace
LegendO[rdf.4]: Inodes
#---------------------------------------------------------------


If you don't want to use rcmd to get data from a remote server,
the script can be run locally without the rcmd.  Details on
request.  I've used the same general form of shell scripting to
extract numbers from sar, df, data loggers, and just about
anything that will belch numbers.

[ ]email  [x]news

Jeff Liebermann  150 Felker St. #D  Santa Cruz CA 95060
(408)699-0483 pager (408)426-1240 fax (408)336-2558 home
http://www.cruzio.com/~jeffl   WB6SSY
jeffl@comix.santa-cruz.ca.us   jeffl@cruzio.com

Technical Details
Message-ID: <3541e250.7034723@news.ricochet.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <353B9E8F.2842E0E9@poseidon.rider.edu> <87hg3m4zkr.fsf@hastur.rlyeh.net>

Show Full Headers
Complete Article Headers
Message-ID: <3541e250.7034723@news.ricochet.net>
Subject: Re: INN stats to MRTG
Date: Thu, 23 Apr 1998 00:00:00 +0000
From: jeffl@comix.santa-cruz.ca.us (Jeff Liebermann)
References: <353B9E8F.2842E0E9@poseidon.rider.edu> <87hg3m4zkr.fsf@hastur.rlyeh.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 346897489
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Reply-To: jeffl@comix.santa-cruz.ca.us
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsabuse@supernews.com
X-Trace: 893314789 F7W8ZAFJM823BCCB3C usenet48.supernews.com
Organization: Committee To Maintain an Independent Xenix
Newsgroups: news.software.nntp