--- atsar-1.7.orig/include/atsar.h +++ atsar-1.7/include/atsar.h @@ -19,7 +19,7 @@ #define ATMAGIC 0xfeedbabe #define ATOUTF "/var/log/atsar/atsa%02d" -#define ATEXEC "/usr/local/bin/atsadc" +#define ATEXEC "/usr/lib/atsar/atsadc" #define MAXNET 32 /* must be power of 2 !! */ /* --- atsar-1.7.orig/scripts/atsa1 +++ atsar-1.7/scripts/atsa1 @@ -1,6 +1,6 @@ #!/bin/sh -COMDIR=/usr/local/bin +COMDIR=/usr/lib/atsar LOGDIR=/var/log/atsar CURDAY=`date +%d` @@ -10,6 +10,11 @@ exit 1 fi +# if the file we're about to write to is older than today (e.g., if we've +# gone a month and we're reusing a two digit day) I'll actually build in a +# little slack in case the system's running slow for some reason +find $LOGDIR/atsa$CURDAY -mtime +2 -type f -exec rm {} \; 2> /dev/null + if [ -f /etc/atsar.conf ] then $COMDIR/atsaftp # count ftp-requests added since previous call @@ -23,10 +28,4 @@ $COMDIR/atsadc $* $LOGDIR/atsa$CURDAY 2> /dev/null fi -# delete files older than one week at midnight -if [ `date +%H` -eq 0 ] -then - find $LOGDIR -name 'atsa*' -mtime +7 -exec rm {} \; -fi - exit 0 --- atsar-1.7.orig/atsar/Makefile +++ atsar-1.7/atsar/Makefile @@ -7,4 +7,4 @@ funcdef.o: ../include/atsar.h ../include/includes.h ../include/linuxstat.h clean: - rm *.o + -rm *.o atsar --- atsar-1.7.orig/atsar/funcdef.c +++ atsar-1.7/atsar/funcdef.c @@ -1328,6 +1328,67 @@ } int +dkline_26(time_t deltasec, time_t deltatic, time_t hz, + int ncpu, struct osrel *osr, char *tstamp) +{ + register int i, nr, lines; + double rd, wr, rs, ws; + char lastchar; + unsigned long deltams = deltatic * 1000 / hz; + struct dkstat *cur, *pre; + + + if ( (nr = getcset("partstat", (void **)&cur, (void **)&pre)) == 0) + return 0; + + for (i=0, lines=0; i < nr; i++, cur++, pre++) + { + if ( cur->readblocks == pre->readblocks && + cur->writblocks == pre->writblocks ) + continue; /* no activity on this partition */ + + /* + ** check if a new partition popped up during interval + */ + if ( (cur->major != pre->major || cur->minor != pre->minor) && + (pre->major != 0 || pre->minor != 0 ) ) + continue; + + rd = subtract(cur->readblocks, pre->readblocks); + wr = subtract(cur->writblocks, pre->writblocks); + rs = subtract(cur->readsectors, pre->readsectors); + ws = subtract(cur->writsectors, pre->writsectors); + + lastchar = cur->name[strlen(cur->name)-1]; + + /* + ** print info for entire disk + */ + if ( !isdigit(lastchar) ) + { + if (lines > 0) + printf ("%s ", tstamp); + + printf("disk%03d-%03d %10.2lf %6.2lf %7.2lf %6.2lf" + " %10.2lf\n", + cur->major, cur->minor, + rd * 1000.0 / deltams, + rs * 1000.0 / 2 / deltams, + wr * 1000.0 / deltams, + ws * 1000.0 / 2 / deltams, + (rd + wr) * 1000.0 / deltams); + lines++; + } + } + + if (lines == 0) + printf("\n"); + + return(1); + +} + +int dkline(time_t deltasec, time_t deltatic, time_t hz, int ncpu, struct osrel *osr, char *tstamp) { @@ -1339,10 +1400,8 @@ ** obtain the general statistics */ if (osr->rel >= 2 && osr->vers >= 6) - { - printf("counter-values in kernel version %d.%d:", - osr->rel, osr->vers); - return 0; + { + return(dkline_26(deltasec, deltatic, hz, ncpu, osr, tstamp)); } if ( !getcset("genstat", (void **)&cur, (void **)&pre) ) --- atsar-1.7.orig/atsadc/Makefile +++ atsar-1.7/atsadc/Makefile @@ -7,4 +7,4 @@ fetchdef.o: ../include/atsar.h ../include/includes.h ../include/linuxstat.h clean: - rm *.o + -rm *.o atsadc --- atsar-1.7.orig/debian/cron.d +++ atsar-1.7/debian/cron.d @@ -0,0 +1,2 @@ +@reboot root test -x /usr/lib/atsar/atsadc && (LOGDIR=/var/log/atsar; CURDAY=`date +\%d`; find $LOGDIR/atsa$CURDAY -mtime +2 -type f -exec rm {} \; 2> /dev/null; /usr/lib/atsar/atsadc $LOGDIR/atsa$CURDAY) +*/10 * * * * root test -x /usr/lib/atsar/atsa1 && /usr/lib/atsar/atsa1 --- atsar-1.7.orig/debian/conffiles +++ atsar-1.7/debian/conffiles @@ -0,0 +1 @@ +/etc/cron.d/atsar --- atsar-1.7.orig/debian/postinst +++ atsar-1.7/debian/postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if ! update-alternatives --display sar | grep -q atsar ; then + update-alternatives --install /usr/bin/sar sar /usr/bin/atsar 0 \ + --slave /usr/share/man/man1/sar.1.gz sar.1.gz /usr/share/man/man1/atsar.1.gz +fi + +#DEBHELPER# + --- atsar-1.7.orig/debian/prerm +++ atsar-1.7/debian/prerm @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +if [ $1 != "upgrade" ] ; then + update-alternatives --remove sar /usr/bin/atsar +fi + +#DEBHELPER# --- atsar-1.7.orig/debian/control +++ atsar-1.7/debian/control @@ -0,0 +1,15 @@ +Source: atsar +Section: admin +Priority: optional +Maintainer: Michael Stone +Standards-Version: 3.6.1.0 +Build-Depends: debhelper + +Package: atsar +Architecture: any +Depends: ${shlibs:Depends} +Recommends: cron +Description: system activity reporter + Monitor system resources such as CPU, network, memory & disk I/O, and + record data for later analysis + --- atsar-1.7.orig/debian/copyright +++ atsar-1.7/debian/copyright @@ -0,0 +1,24 @@ +This is the Debian GNU/Linux prepackaged version of atsar_linux + +This package is maintained by Michael Stone and +built from sources obtained from: + ftp://ftp.atcomputing.nl/pub/tools/linux/atsar_linux-1.7.tar.gz + +Changes: + * added Debian GNU/Linux package maintenance system files + +atsar is Copyright (C) 1999 by AT Computing + +** This program is free software; you can redistribute it and/or modify it +** under the terms of the GNU General Public License as published by the +** Free Software Foundation; either version 2, or (at your option) any +** later version. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +** See the GNU General Public License for more details. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + --- atsar-1.7.orig/debian/rules +++ atsar-1.7/debian/rules @@ -0,0 +1,79 @@ +#!/usr/bin/make -f +# Based heavily on Ian Jackson's sample rules file for GNU hello +# Copyright 1994,1995 by Ian Jackson. +# I hereby give you perpetual unlimited permission to copy, +# modify and relicense this file, provided that you do not remove +# my name from the file itself. (I assert my moral right of +# paternity under the Copyright, Designs and Patents Act 1988.) + +package=atsar + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) +CFLAGS = -g -I../include -Wall -O0 -fno-strict-aliasing +else +CFLAGS = -g -I../include -Wall -O2 -fno-strict-aliasing +endif +LDFLAGS = + +build: stamp-build + +stamp-build: + dh_testdir + $(MAKE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" + touch stamp-build + +clean: + dh_testdir + make clean + rm -f stamp-build + dh_clean + +binary-indep: stamp-build + dh_testdir +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: stamp-build + dh_testdir + dh_testroot + dh_clean -k + + mkdir -p debian/tmp/usr/bin + cp atsar/atsar debian/tmp/usr/bin + mkdir -p debian/tmp/usr/lib/atsar + cp atsadc/atsadc debian/tmp/usr/lib/atsar + cp scripts/atsa1 debian/tmp/usr/lib/atsar + mkdir -p debian/tmp/usr/share/man/man1 + cp man/atsar.1 debian/tmp/usr/share/man/man1 + mkdir -p debian/tmp/usr/share/man/man8 + cp man/atsadc.1 debian/tmp/usr/share/man/man8/atsadc.8 + ln -s atsadc.8 debian/tmp/usr/share/man/man8/atsa1.8 + mkdir -p debian/tmp/var/log/atsar + + dh_installdocs README + + dh_installcron + + dh_installchangelogs + + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +.PHONY: binary binary-arch binary-indep clean + + + --- atsar-1.7.orig/debian/changelog +++ atsar-1.7/debian/changelog @@ -0,0 +1,86 @@ +atsar (1.7-2) unstable; urgency=low + + * correct calculations for 2.6 -d :) + + -- Michael Stone Fri, 23 Jul 2004 09:11:22 -0400 + +atsar (1.7-1) unstable; urgency=low + + * new upstream version + - linux 2.6 support + * add support for -d for 2.6 kernel + * policy 3.6.1.0 + + -- Michael Stone Thu, 22 Jul 2004 21:19:09 -0400 + +atsar (1.6-3) unstable; urgency=low + + * update description (Closes: #124431) + * use */n syntax in cron entry (Closes: #177728) + * delete out of date sar file on boot + * update policy to 3.5.8.0 + + -- Michael Stone Sun, 09 Feb 2003 14:02:14 -0500 + +atsar (1.6-2) unstable; urgency=low + + * fixed a lot of format strings + * -g in CFLAGS + + -- Michael Stone Wed, 25 Jul 2001 16:25:50 -0400 + +atsar (1.6-1) unstable; urgency=low + + * new upstream version + * ftp & web monitoring packaged RSN + + -- Michael Stone Tue, 24 Jul 2001 11:16:27 -0400 + +atsar (1.5-7) unstable; urgency=low + + * forgot to redirect find output + + -- Michael Stone Tue, 24 Jul 2001 08:55:09 -0400 + +atsar (1.5-6) unstable; urgency=low + + * cron wants % escaped (Closes: #98236) + * change cron test to look for the right file (Closes: #86046) + * don't delete files after one week + * do delete files that are not from today before writing to them + (Closes: #87286) + + -- Michael Stone Sun, 8 Jul 2001 09:35:43 -0400 + +atsar (1.5-5) unstable; urgency=low + + * fixed update-alternatives (Closes: #81046) + * fixed sa1 script (Closes: #79426) + + -- Michael Stone Tue, 2 Jan 2001 07:10:36 -0500 + +atsar (1.5-4) unstable; urgency=low + + * supports new disk stat format in 2.4 kernels + + -- Michael Stone Fri, 1 Dec 2000 06:42:16 -0500 + +atsar (1.5-3) unstable; urgency=low + + * sar is an alternative + * atsar logs are deleted after a week + + -- Michael Stone Tue, 28 Nov 2000 19:29:37 -0500 + +atsar (1.5-2) unstable; urgency=low + + * forgot to Recommend: cron + * rm shouldn't fail in debian/rules (Closes: #69705, #69853) + + -- Michael Stone Thu, 24 Aug 2000 17:38:58 -0400 + +atsar (1.5-1) unstable; urgency=low + + * inital package + + -- Michael Stone Sun, 13 Aug 2000 12:23:08 -0400 --- atsar-1.7.orig/Makefile +++ atsar-1.7/Makefile @@ -5,15 +5,14 @@ # Ports of atsar for other UNIX-versions are available on request. # # -CFLAGS=-I../include -DWEBSUPPORT -Wall +CFLAGS=-I../include -g -Wall -fno-strict-aliasing -all: - cc -c version.c +all: version.o cd atsadc; make "CFLAGS=$(CFLAGS)" cd atsar; make "CFLAGS=$(CFLAGS)" clean: - rm *.o + -rm *.o cd atsar; make clean cd atsadc; make clean