[mrtg] Re: Help - Sun Ultra 5

Glenn Forbes Fleming Larratt glratt at rice.edu
Thu Jan 24 23:50:50 MET 2002


I have found no such MIB / OID. However, my UNIX support folks helped me
 come up with a method that allows me to do this sort of monitoring, at
least on a small scale, as follows (Done on Solaris 2.6-2.8 boxen with
tcp_wrappers, within a single LAN for security  - your mileage may vary) :

	1. Configure the target hosts as follows:

	1a. Patch /etc/inetd.conf to include:

mrtgfeedcpu     stream  tcp     nowait  nobody  /usr/sbin/tcpd  /usr/ucb/uptime
mrtgfeeddisk    stream  tcp     nowait  nobody  /usr/sbin/tcpd  /usr/bin/df -k

	1b. Patch /etc/services to include (pick arbitrary ports):

mrtgfeedcpu     31338/tcp
mrtgfeeddisk    31339/tcp

	1c. Patch /etc/services to include (substitute your MRTG hosts):

uptime: MY.NET.MRTG.HOST1, MY.NET.MRTG.HOST2
df: MY.NET.MRTG.HOST1, MY.NET.MRTG.HOST2

	1d. pskill -HUP inetd

	1e. test by "telnet target 31338", e.g., from your MRTG host;
	if it works, you should see the standard df or uptime output.

	2. Install the following scripts on your MRTG hosts:

	2a. inetdcpu:
================
#!/usr/local/bin/perl
# or wherever perl is on your MRTG host

if(($target = shift(@ARGV)) =~ /^(\S+):(\d+)$/
   && ($_ = join("",`/usr/ucb/telnet $1 $2 2>&1`))
   && (/load average:\s+([\d\.]+),\s/m))
{ printf "%d\n0\n0\n0\n",100*$1; }
else
{ printf "0\n0\n0\n0\n" ; }
================

	2b. inetddisk:
================
#!/usr/local/bin/perl
# or wherever perl is on your MRTG host

$| = 1; # unbuffered output
$targetdir = "/tmp/.inetddisk";
$result = 0;

unless(-d $targetdir)
{ mkdir $targetdir,0755; } # target directory to cache "df -k" output;
                           # by caching, we only do "df -k" once, and
                           # reduce cycle and network utilization

if(($target = shift(@ARGV)) =~ /^(\S+):(\d+):(\S+)$/)
{
   ($host,$port,$partition) = ($1,$2,$3);
   $targetfile = "$targetdir/$host:$port";
   @stat = stat($targetfile);
   if($stat[10] && (time - $stat[10]) < (3*60)) # use cached data if it's
                                                # less than 3 minutes old
   { $_ = join("",`/usr/bin/cat $targetfile`); }
   else                                         # otherwise, repoll and
   {                                            # repopulate the cache
     $_ = join("",`/usr/ucb/telnet $1 $2 2>&1`);
     open(OUT,">$targetfile");
     print OUT;
     close(OUT);
   }
   if(/(\d+)\%\s+$partition$/m)
   { $result = $1; }
}
printf "%d\n0\n0\n0\n",$result;
================

	3. Finally, configure your an mrtg.cfg file thus:
================
WorkDir: {as appropriate}
IconDir: {as appropriate}
Refresh: 300
Options[_]: gauge, nopercent, growright
MaxBytes[_]: 100
AbsMax[_]: 100
WithPeak[_]: dwm
YLegend[_]: % CPU Busy
Legend1[_]: 5 Minute
Legend3[_]: Maximum 5 Minute
ShortLegend[_]: %
######################################################################
#---------------------------------------------------------------

Target[target_netserv_cpu]: `{fullpath}/inetdcpu target:31338`
Options[target_netserv_cpu]: gauge,noinfo,nopercent,growright
YLegend[target_netserv_cpu]: CPU Load
WithPeak[target_netserv_cpu]: dwmy
Unscaled[target_netserv_cpu]: dwmy
ShortLegend[target_netserv_cpu]: %
MaxBytes[target_netserv_cpu]: 100
AbsMax[target_netserv_cpu]: 1000
LegendI[target_netserv_cpu]: Load
LegendO[target_netserv_cpu]:
Title[target_netserv_cpu]: target.my.domain: CPU
PageTop[target_netserv_cpu]: <H1>CPU Load for target.my.domain, normalized 100% = 1.0
 </H1>
#---------------------------------------------------------------

Target[target_disk_]: `{fullpath}/inetddisk target:31339:/`
Options[target_disk_]: gauge,noinfo,nopercent,growright
YLegend[target_disk_]: % capacity
WithPeak[target_disk_]: dwmy
Unscaled[target_disk_]: dwmy
ShortLegend[target_disk_]: %
MaxBytes[target_disk_]: 100
LegendI[target_disk_]: capacity
LegendO[target_disk_]:
Title[target_disk_]: target.my.domain: % capacity on /
PageTop[target_disk_]: <H1>% capacity on / for target.my.domain
 </H1>

#---------------------------------------------------------------

Target[target_disk_usr]: `{fullpath}/inetddisk target:31339:/usr`
Options[target_disk_usr]: gauge,noinfo,nopercent,growright
YLegend[target_disk_usr]: % capacity
WithPeak[target_disk_usr]: dwmy
Unscaled[target_disk_usr]: dwmy
ShortLegend[target_disk_usr]: %
MaxBytes[target_disk_usr]: 100
LegendI[target_disk_usr]: capacity
LegendO[target_disk_usr]:
Title[target_disk_usr]: target.my.domain: % capacity on /usr
PageTop[target_disk_usr]: <H1>% capacity on /usr for target.my.domain
 </H1>

================

	-g


On Thu, 24 Jan 2002, Anup Sharma wrote:

> Hello everyone
>
> I have been successful in monitoring our WinNT/2000 (Compaq) servers, for
> traffic, cpu, diskusage etc. I use the getif and snmputil to query the OIDs
> and do SNMP walks.
>
>  It had all been working well, until I had to start tracking some Sun Boxes.
> I am trying to monitor a Sun Ultra 5.  I downloaded mibs from SUN, when I
> query things like .iso.org.dod.internet.mgmt.mib-2.ip , I get all the
> results. I am not able to figure the OIDs for Disk, CPU Usage for SUN.
>
> Can anyone please tell me, or point me to the right MIBs, or if possible the
> OIDs, for Disk Usage, CPU Usage,
>
> TIA
> Anup Sharma
>
> --
> Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
> Archive     http://www.ee.ethz.ch/~slist/mrtg
> FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
>
>

				Glenn Forbes Fleming Larratt
				Rice University Network Management
				glratt at rice.edu


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list