SUMMARY: Accounting on diskless SLC's

From: Peter Phillips. (pete@egh-qc.uucp)
Date: Mon Aug 03 1992 - 04:58:03 CDT


Thanks to all who replied to my query - original message at the end.

I found the best method was Ed Arnolds perl script, which I called dffilter.
Now I run the df command through dffilter in the ckpacct and runacct scripts, and
it makes the df command work fine whether it's on an nfs mounted system or not.

Eg:
_blocks=`df /usr | /usr/local/bin/dffilter | awk '{print \$4}' | egrep "[0-9]"`

Over the weekend accounting on our SLC's _seems_ to be OK - if I get any problems
I will report here.

On Jul 30, 8:20am, Russ Poffenberger wrote:
>
> This is a common problem I have seen with scripts that use df to find the
> disk space free. I have several installation scripts from various places
> that make this same brain-dead mistake, failing to realize that a df, where
> the filesystem is very long (typical on NFS mounted filesystem), may
> break it into 2 lines. What the scripts typically do is drop the first
> line, and only look at the second line, but it is one field short, so
> they read the % capacity instead of the avail bytes.
>
> I don't know of an easy solution unless df can be coaxed to not break the
> line. Otherwise you would have to make the script more intelligent.
>
> Russ Poffenberger DOMAIN: poffen@sj.ate.slb.com
> Schlumberger Technologies UUCP: {uunet,decwrl,amdahl}!sjsca4!poffen
> 1601 Technology Drive CIS: 72401,276
> San Jose, Ca. 95110 Voice: (408)437-5254 FAX: (408)437-5246
>-- End of excerpt from Russ Poffenberger

On Jul 30, 2:18pm, C.Eagle@massey.ac.nz wrote:
> Subject: Re: Accounting on diskless SLC's - help please.
> I have hacked ckpacct so that it works on diskless workstations, and tells me
which machine is having problems.
> The diff between the current ckpacct and the original follow - let me know if
> you need more info. (This assumes all machines using accounting are diskless -
> there are no checks on diskless/diskfull).
>
> Hope this helps,
> Colin
>
> sis-lab12 /usr/lib/acct -> diff ckpacct ckpacct.o
> 18d17
> < _HOST=`hostname`
> 39c38
> < _blocks=`df /usr | awk '{print \$3}' | egrep "[0-9]"`
> ---
> > _blocks=`df /usr | awk '{print \$4}' | egrep "[0-9]"`
> 42c41
> < echo " $_HOST ckpacct: /usr still low on space ($_blocks blks - need
$_MIN_BLKS blks);"
> ---
> > echo " ckpacct: /usr still low on space ($_blocks blks);"
> 44c43
> < ( echo " $_HOST ckpacct: /usr still low on space ($_blocks blks -
need $_MIN_BLKS blks);"
> ---
> > ( echo " ckpacct: /usr still low on space ($_blocks blks);"
> 48c47
> < echo " $_HOST ckpacct: /usr too low on space ($_blocks blks - need
$_MIN_BLKS blks);"
> ---
> > echo " ckpacct: /usr too low on space ($_blocks blks);"
> 50c49
> < ( echo " $_HOST ckpacct: /usr too low on space ($_blocks blks -
need $_MIN_BLKS blks);"
> ---
> > ( echo " ckpacct: /usr too low on space ($_blocks blks);"
> 56c55
> < echo " $_HOST ckpacct: /usr free space restored; turning acctg on" | \
> ---
> > echo " ckpacct: /usr free space restored; turning acctg on" | \
>-- End of excerpt from C.Eagle@massey.ac.nz

On Jul 30, 10:02am, Ed Arnold wrote:
>
> It's not a difference between the server and clients; some ill-informed
> person who didn't know about tools like awk and perl, wrote df so that
> when the filesystem name is very long (like, a NFS-mounted filesystem),
> df splits the line so the other items fall directly under the titles.
> Must have been an ex-IBMer. :-)
>
> We had to fix this for use with the system watcher; the solution here
> was to write a short perl script to join these lines back together:
>
> #!/usr/local/bin/perl
> # because "df" wraps info down onto a continuation line when the
> # first item (device name) is too long (e.g. NFS filesystem), we use
> # this script to join such lines back together.
> # note that we always skip the first line, just like "tail +2"
>
> $junk = <STDIN>;
> while (<STDIN>)
> {
> @fields = split(/\s+/,$_);
> if ($#fields == 0) # we need to join with next line
> {
> $dev = $fields[0];
> $rest = substr(<STDIN>,22);
> $_ = join(' ',$dev,$rest);
> }
> print "$_";
> }
>
> --
> Ed Arnold * NCAR * POB 3000, Boulder, CO 80307-3000 * 303-497-1253(voice)
> 303-497-{1298,1137}(fax) * era@ncar.ucar.edu [128.117.64.4] * era@ncario.BITNET
>-- End of excerpt from Ed Arnold

On Jul 30, 2:04pm, Juergen.Obermann@HRZ.uni-giessen.dbp.de wrote:

> I had the same problem just a few days ago. It turns out that two
> scripts 'ckpacct' and 'runacct' have this problem, and that it are in
> fact two bugs! Both scripts check if there are less than 500 blocks
> left on /usr to not fill the disk with accounting if it is nearly full.
> But since I don't know when accounting is in /var/adm/acct and /usr/adm
> is a symbolic link to /var/adm. So the scripts must check /usr/adm
> instead. Second bug, the scripts must use the 3rd and not the 4th
> parameter of the df command output, unless the disk is 500% free (:-).
> I see no other way than to hack those scripts.
>
> Juergen
> +-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-+
> | Juergen Obermann Hochschulrechenzentrum der |
> | Tel: +49-641-702-2169 Justus-Liebig-Universitaet Giessen |
> | E-Mail: Juergen.Obermann Heinrich-Buff-Ring 44 |
> | @hrz.uni-giessen.dbp.de D-6300 Giessen |
> +-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-+
>
---------- Hacked ckpacct and runacct scripts deleted - essentially changing the
fields which awk picks up, but as ckpacct and runacct are proprietary source code,
I've not included them. -----------------
>-- End of excerpt from Juergen.Obermann@HRZ.uni-giessen.dbp.de

Original message:

On Jul 29, 8:38am, Peter Phillips. wrote:
> Subject: Accounting on diskless SLC's - help please.
>
> Hi,
>
> We have a SparcII with 3 SLC's attached. Accounting works fine on the
> SParcII, but when I try to turn accounting on on the SLC's it doesn't work.
>
> I think I've tracked the problem down to the way df reports file system usage
> over NFS - on our server, df gives:
>
> Filesystem kbytes used avail capacity Mounted on
> /dev/sd0g 143641 122599 6677 95% /usr
>
> on our SLC's, I get:
>
> Filesystem kbytes used avail capacity Mounted on
> enterprise:/export/exec/sun4.sunos.4.1.1
> 143641 122599 6677 95% /usr
>
> Thus when ckpacct runs, it gets the percent capacity figure on the SLC's
> instead of the avail no of blocks.
>
> My Question
> ===========
> I guess I could hack ckpacct to determine if the file type was nfs or 4.2, but
> I'm nervous about hacking at core scripts like this. However, I'd really like
> to monitor what's happening on our SLC's.
>
> Has anyone solved this problem without recourse to hacking the above ? If
> anyone _has_ had to hack ckpacct, do you have the hack available ?
>
> THanks in advance,
> Pete
>
> --
> --
> Pete Phillips, TEL : 0656-652166 (Direct)
> Deputy Director,
> Surgical Materials Testing Laboratory,
> Bridgend General Hospital,
> Bridgend, UUCP : uknet!egh-qc!pete
> SOUTH WALES, CF31 1JP DOMAIN : pete@egh-qc.co.uk
> === "A man is only as stupid as the woman who tells him what to do." ===
>-- End of excerpt from Peter Phillips.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:46 CDT