mrtgutils-0.8.1ubuntu1/0000775000000000000000000000000011634220114011760 5ustar mrtgutils-0.8.1ubuntu1/mrtg-ip-acct.c0000664000000000000000000000204610540405773014430 0ustar #include "uptime.h" #include "util.h" #include #include #include void print_ipacct(char *dev, int packets) { char buf[1024]; char *p; FILE *f; unsigned long long in = 0, out = 0; f = fopen("/proc/net/dev", "r"); if (!f) return; while (!feof(f)) { fgets(buf, sizeof(buf), f); p = buf; while (isspace(*p)) p++; if (strncmp(dev, p, strlen(dev)) == 0) { while (*p != ':') p++; p++; if (packets) sscanf(p, "%*d %Lu %*d %*d %*d %*d %*d %*d %*d %Lu %*d %*d %*d %*d %*d %*d", &in, &out); else sscanf(p, "%Lu %*d %*d %*d %*d %*d %*d %*d %Lu %*d %*d %*d %*d %*d %*d %*d", &in, &out); } } fclose(f); printf("%Lu\n%Lu\n", in, out); } int main(int argc, char **argv) { char *device = "eth0"; int packets = 0; int nextarg = 1; if (argc > nextarg && !strncmp(argv[nextarg], "-p", 3)) { packets = 1; ++nextarg; } if (argc > nextarg) device = argv[nextarg]; print_ipacct(device, packets); print_uptime(); print_hostname(); return 0; } mrtgutils-0.8.1ubuntu1/mrtg-apache.c0000664000000000000000000000451007250572325014331 0ustar #include "uptime.h" #include "util.h" #include #include #include #include #include #include #include #include #define REQUEST "GET /%s?auto\n" #define PERROR(c) do { perror(c); exit(1); } while (0); #define DIE(fmt, arg...) do { fprintf(stderr, fmt, ##arg); exit(1); } while (0); #define SHOWUSAGE DIE("Usage: mrtg-apache [-p port] [-m multiplier] [-s status-directory] -q\n") static int quiet = 0; void print_accesses(char *hostname, int port, char *statusdir, int multiplier) { int s, bytesread; char buf[2048], input[256], *p; struct sockaddr_in addr; struct hostent *h = gethostbyname(hostname); unsigned long accesses = 0; memset(&addr, 0, sizeof(addr)); if (!h) { if (quiet) { printf("0\n"); return; } else { DIE("Cannot resolve %s\n", hostname); } } addr.sin_family = AF_INET; addr.sin_port = htons(port); memcpy(&addr.sin_addr, h->h_addr, sizeof(addr.sin_addr)); snprintf(buf, sizeof(buf), REQUEST, statusdir); if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) PERROR("socket"); if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) PERROR("connect"); if (write(s, buf, strlen(buf)+1) < 0) PERROR("write"); p = buf; *p = 0; while ((bytesread = read(s, input, sizeof(input))) > 0) { if (sizeof(buf) - (p - buf) > bytesread) { memcpy(p, input, bytesread); p += bytesread; } else { /* buffer is not big enough; assume that we've read enough and just * quit */ break; } } if ((p = strstr(buf, "Total Accesses: "))) { accesses = strtoul(p + 16, NULL, 0); } printf("%lu\n", accesses * multiplier); close(s); return; } int main(int argc, char **argv) { char *hostname; int port = 80; int multiplier = 1; char *statusdir = "server-status"; int c; while ((c = getopt(argc, argv, "qp:m:s:")) > 0) { switch (c) { case 'q': quiet = 1; break; case 'p': port = atoi(optarg); break; case 'm': multiplier = atoi(optarg); break; case 's': statusdir = optarg; break; default: SHOWUSAGE; } } if (optind >= argc) SHOWUSAGE; hostname = argv[optind]; printf("0\n"); print_accesses(hostname, port, statusdir, multiplier); print_uptime(); print_hostname(); return 0; } mrtgutils-0.8.1ubuntu1/mrtg-load.pod0000664000000000000000000000116607044744065014376 0ustar =head1 NAME mrtg-load - Returns the current load average (5-minute average) =head1 SYNOPSIS mrtg-load [B<-m> multiplier] =head1 DESCRIPTION mrtg-load returns the 5-minute load average of the machine. The output is written in a form useful as input for the mrtg utility. B<-m> is the multiplier to be used in the output. For example, with a load of 1.2 and a multiplier of 100, the output load average will be 120. The default multiplier is 1. =head1 SEE ALSO mrtg(1) =head1 AUTHOR mrtg-apache was written by Randolph Chung Etausq@debian.orgE. =head1 HISTORY This document first appeared with mrtgutils-0.1 mrtgutils-0.8.1ubuntu1/util.h0000664000000000000000000000010207041756027013115 0ustar #ifndef UTIL_H #define UTIL_H void print_hostname(void); #endif mrtgutils-0.8.1ubuntu1/mrtg-sensors.pod0000664000000000000000000000325207250365777015161 0ustar =head1 NAME mrtg-sensors - Returns data from lm-sensors =head1 SYNOPSIS mrtg-sensors [B<-m> multiplier] chip label [chip label] =head1 DESCRIPTION mrtg-sensors uses the lm-sensors library to query various system sensors for information such as temperature, fan speed, etc. The output is written in a form useful as input for the mrtg utility. Up to two pairs of chips and labels may be specified. The first is used for the incoming data value in mrtg, while the second is used for the outgoing data value. Of course, they need not correspond to incoming or outgoing data, that is merely what mrtg expects. "chip" is the name of the chip to query, and "label" is the label of the piece of information that should be queried from the given chip. sensors(1) can be used to look up all available chips and labels on your system. Wildcards may be used in chip names, but only the first matching chip will be queried. If you use the special name "dummy" as a chip name, nothing will be queried, and a value of zero will be sent to mrtg. B<-m> is the multiplier to be used in the output. The default multiplier is 1. Note that you may find it more useful to use sensors.conf(5) to set global multipliers for sensors. =head1 EXAMPLES =over 4 =item mrtg-sensors dummy dummy adm9240-\* fan2 Get the speed of fan #2 from the adm9240 chip. =item mrtg-sensors -m 0.5 adm9240-\* fan1 adm9240-\* fan2 Get the speeds of both fan #1 and fan #2, halfing both. =item mrtg-sensors -m 2 dummy dummy adm9240-\* temp Get the cpu termerature, and double it. =back =head1 SEE ALSO sensors(1) sensors.conf(5) =head1 AUTHOR mrtg-sensors was written by Joey 'no pseudo-code' Hess Ejoeyh@debian.orgE. mrtgutils-0.8.1ubuntu1/mrtg-ip-acct.pod0000664000000000000000000000110307044744761014771 0ustar =head1 NAME mrtg-ip-acct - Returns the number of IP packets that have traversed a network interface =head1 SYNOPSIS mrtg-ip-acct [Einterface nameE] =head1 DESCRIPTION mrtg-ip-acct returns the number of bytes that have been received and sent on a given interface. The output is written in a form useful as input for the mrtg utility. If no interface name is given, the default is eth0. =head1 SEE ALSO mrtg(1) =head1 AUTHOR mrtg-apache was written by Randolph Chung Etausq@debian.orgE. =head1 HISTORY This document first appeared with mrtgutils-0.1 mrtgutils-0.8.1ubuntu1/util.c0000664000000000000000000000046707044742403013122 0ustar #include "util.h" #include #include #include #include #include void print_hostname(void) { char hostname[255]; struct hostent *h; gethostname(hostname, sizeof(hostname)); h = gethostbyname(hostname); printf("%s\n", (h ? h->h_name : "(none)")); } mrtgutils-0.8.1ubuntu1/uptime.c0000664000000000000000000000613507041735367013456 0ustar #include #include #include #include #include #include #include #include #include "uptime.h" static char buf[128]; static double av[3]; static int uptime (double *, double *); static char *sprint_uptime(void); int uptime(double *uptime_secs, double *idle_secs) { double up=0, idle=0; FILE *f; f = fopen("/proc/uptime", "r"); if (!f) return -1; if (fscanf(f, "%lf %lf", &up, &idle) < 2) { fprintf(stderr, "bad data in /proc/uptime\n"); return 0; } fclose(f); if (uptime_secs) *uptime_secs = up; if (idle_secs) *idle_secs = idle; return up; /* assume never be zero seconds in practice */ } void loadavg(double *av1, double *av5, double *av15) { double avg_1=0, avg_5=0, avg_15=0; FILE *f; f = fopen("/proc/loadavg", "r"); if (!f) return; if (fscanf(f, "%lf %lf %lf", &avg_1, &avg_5, &avg_15) < 3) { fprintf(stderr, "bad data in /proc/loadavg\n"); exit(1); } if (av1) *av1 = avg_1; if (av5) *av5 = avg_5; if (av15) *av15 = avg_15; } char *sprint_uptime(void) { struct utmp *utmpstruct; int upminutes, uphours, updays; int pos; struct tm *realtime; time_t realseconds; int numuser; double uptime_secs, idle_secs; /* first get the current time */ time(&realseconds); realtime = localtime(&realseconds); pos = sprintf(buf, " %2d:%02d%s ", realtime->tm_hour%12 ? realtime->tm_hour%12 : 12, realtime->tm_min, realtime->tm_hour > 11 ? "pm" : "am"); /* read and calculate the amount of uptime */ uptime(&uptime_secs, &idle_secs); updays = (int) uptime_secs / (60*60*24); strcat (buf, "up "); pos += 3; if (updays) pos += sprintf(buf + pos, "%d day%s, ", updays, (updays != 1) ? "s" : ""); upminutes = (int) uptime_secs / 60; uphours = upminutes / 60; uphours = uphours % 24; upminutes = upminutes % 60; if(uphours) pos += sprintf(buf + pos, "%2d:%02d, ", uphours, upminutes); else pos += sprintf(buf + pos, "%d min, ", upminutes); /* count the number of users */ numuser = 0; setutent(); while ((utmpstruct = getutent())) { if ((utmpstruct->ut_type == USER_PROCESS) && (utmpstruct->ut_name[0] != '\0')) numuser++; } endutent(); pos += sprintf(buf + pos, "%2d user%s, ", numuser, numuser == 1 ? "" : "s"); loadavg(&av[0], &av[1], &av[2]); pos += sprintf(buf + pos, " load average: %.2f, %.2f, %.2f", av[0], av[1], av[2]); return buf; } void print_uptime(void) { printf("%s\n", sprint_uptime()); } /* This is a trivial uptime program. I hereby release this program * into the public domain. I disclaim any responsibility for this * program --- use it at your own risk. (as if there were any.. ;-) * -michaelkjohnson (johnsonm@sunsite.unc.edu) * * Modified by Larry Greenfield to give a more traditional output, * count users, etc. (greenfie@gauss.rutgers.edu) * * Modified by mkj again to fix a few tiny buglies. * * Modified by J. Cowley to add printing the uptime message to a * string (for top) and to optimize file handling. 19 Mar 1993. * */ mrtgutils-0.8.1ubuntu1/mrtg-sensors.c0000664000000000000000000000503311634217764014611 0ustar #include "uptime.h" #include "util.h" #include #include #include #include #include #include #include int print_value(char *chipname, char *label, double mult) { int a, b, chip_nr, gotchip; const sensors_feature *feature; const sensors_subfeature *subfeature; char *name; double val; const sensors_chip_name *chip; sensors_chip_name chipparsed; /* Special dummy chip. */ if (strcmp(chipname, "dummy") == 0) { printf("0\n"); return(1); } if (sensors_parse_chip_name(chipname, &chipparsed) != 0) { fprintf(stderr, "error parsing chip name, \"%s\"\n", chipname); printf("0\n"); return(0); } /* * To make wildcards work, iterate over all chips until one that * matches the parsed name is found. */ for (gotchip= chip_nr = 0; ! gotchip && (chip = sensors_get_detected_chips(&chipparsed, &chip_nr));) gotchip = 1; if (!gotchip) { fprintf(stderr, "could not find chip, \"%s\"\n", chipname); printf("0\n"); return(0); } /* * Now get all features and iterate through to find * the one that was requested. */ a=0; while ((feature=sensors_get_features(chip, &a))) { b=0; while ((subfeature=sensors_get_all_subfeatures(chip, feature, &b))) { if ((name = sensors_get_label(chip, feature)) && (strcmp(name, label) == 0) && (sensors_get_value(chip, subfeature->number, &val)) == 0) { printf("%.0f\n", val * mult); return(1); } } } fprintf(stderr, "could not find label %s\n", label); printf("0\n"); return(0); } void usage (void) { fprintf(stderr, "Usage: mrtg-sensors [-m multiplier] chip label [chip label]\n"); exit(1); } int main (int argc, char *argv[]) { int res, c, success = 1; double mult = 1; while ((c = getopt(argc, argv, "m:")) > 0) { switch (c) { case 'm': mult = atof(optarg); break; default: usage(); } } if (optind >= argc || (argc - optind != 2 && argc - optind != 4)) usage(); if ((res = sensors_init(NULL))) { if (res == SENSORS_ERR_KERNEL) { fprintf(stderr, "/proc/sys/dev/sensors/chips or /proc/bus/i2c unreadable:\n" "Make sure you have inserted modules sensors.o and i2c-proc.o!"); } else { fprintf(stderr,"%s\n",sensors_strerror(res)); } exit(1); } success = success & print_value(argv[optind], argv[optind+1], mult); if (argc - optind == 4) success = success & print_value(argv[optind+2] , argv[optind+3], mult); else printf("0\n"); print_uptime(); print_hostname(); if (success) return(0); else return(1); } mrtgutils-0.8.1ubuntu1/debian/0000775000000000000000000000000011634220041013201 5ustar mrtgutils-0.8.1ubuntu1/debian/compat0000664000000000000000000000000211446655634014424 0ustar 8 mrtgutils-0.8.1ubuntu1/debian/copyright0000664000000000000000000000172011446660225015151 0ustar The current Debian maintainer is Luciano Bello It was downloaded from: http://www.download.address/foo.bar.tgz Upstream Author: Luciano Bello Copyright: 2007 Randolph Chung (original writer) 2008-2010 Luciano Bello 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 of the License. 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 systems, the complete text of the GNU General Public License, version 2, can be found in /usr/share/common-licenses/GPL-2. The Debian packaging is (C) 2008, Luciano Bello and is licensed under the GPL-2, see above. mrtgutils-0.8.1ubuntu1/debian/control0000664000000000000000000000321311634217271014616 0ustar Source: mrtgutils Section: net Priority: optional Build-Depends: debhelper (>= 8), libsensors4-dev Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Luciano Bello Standards-Version: 3.9.1 Package: mrtgutils Architecture: any Priority: optional Section: net Depends: ${shlibs:Depends}, ${misc:Depends} Suggests: mrtg, mrtgutils-sensors Description: Utilities to generate statistics for mrtg MRTGutils is a collection of simple utilities to generate output useful for mrtg. Many of the existing mrtg setups use shell or perl scripts to gather output. On busy systems, these scripts can generate a lot of extra load. These (small) C programs can return the given statistics more efficiently. . This package provides the following binaries that return: - mrtg-load: the current load average (5-minute average) - mrtg-ip-acct: the number of IP packets that have traversed an interface - mrtg-apache: the number of hits to a Apache web site Package: mrtgutils-sensors Architecture: any Priority: optional Section: net Depends: ${shlibs:Depends}, ${misc:Depends} Suggests: mrtgutils Conflicts: mrtgutils (<= 0.7) Description: Utilities to generate statistics for mrtg (from lm-sensors) MRTGutils is a collection of simple utilities to generate output useful for mrtg. Many of the existing mrtg setups use shell or perl scripts to gather output. On busy systems, these scripts can generate a lot of extra load. These (small) C programs can return the given statistics more efficiently. . This package provides the binary mrtg-sensors that returns data sensors information from lm-sensors. mrtgutils-0.8.1ubuntu1/debian/debian/0000775000000000000000000000000011447454276014450 5ustar mrtgutils-0.8.1ubuntu1/debian/debian/mrtgutils-sensors/0000775000000000000000000000000011447454221020162 5ustar mrtgutils-0.8.1ubuntu1/debian/debian/mrtgutils-sensors/usr/0000775000000000000000000000000011447454221020773 5ustar mrtgutils-0.8.1ubuntu1/debian/debian/mrtgutils-sensors/usr/bin/0000775000000000000000000000000011447454221021543 5ustar mrtgutils-0.8.1ubuntu1/debian/debian/mrtgutils-sensors/usr/bin/mrtg-sensors0000775000000000000000000003256011447454220024141 0ustar ELF>@@`@8@@@@@@@@@@$$ ((`(` PP`P`@@DDPtd@@LLQtd/lib64/ld-linux-x86-64.so.2GNUGNU)L3C{%beY >^%'" #!& %$  !L !$|CEqX82Rz E fSm0_:yo t```>0` @4@ `7(`libsensors.so.4__gmon_start___Jv_RegisterClasses_finisensors_parse_chip_namesensors_get_detected_chipssensors_get_featuressensors_get_all_subfeaturessensors_get_labelsensors_get_valuesensors_initsensors_strerrorlibc.so.6exitsprintffopenoptindputsstrtodsetutentgetopt__isoc99_fscanffcloseoptargstderrgethostbynamegethostnamefwriteendutentlocaltimefprintfgetutentstrcmp__libc_start_main_edata__bss_start_endGLIBC_2.7GLIBC_2.2.5ii ui ` `%(`&0`" `(`0`8`@`H`P` X` `` h` p` x`````````````````H u H5 % @% h% h%  h% h% h% h% h% hp% h`% h P% h @% h 0% h % h % h% h% h% h% h% h%z h%r h%j h%b hp%Z h`%R hP%J h@%B h01I^HHPTI@H@HP@HH  HtHÐUHSH= uK@`H H8`HHH9s$fDHH 8`H H9r H[fff.UH= HtHtH`ÐH\$Hl$HLd$@H8I@HHD$HD$HD$HtLHL$HT$LD$HǾ@1~=Mt HD$I$Ht HD$HEHtHD$HH\$ Hl$(Ld$0H8H @USH8H\$(HHX@A@H@`` LOº*)¸ R)ӉD1@@HD$ HD$HHt6HL$HT$ HǾ@1 HD$ D$D$E.¹``,؉)‹1H!%tDHqHDHup 8 )ىȾ< *)É)R)щ)Hc+@1H``,(1H[Htf8fux,BHuDs@Hc@ھ?@HDH``1:`þ``<+I  9 P@$ HcH````fH8[]@Hc@ @HEH``1f.Hcʾ6@H``1,(H @SHH{HHp@tH8H[ÐHH x@<AWAVAUATUHP@SHHHHD$)Ld$HLQH꾸@Ht$4LD$4HILt$APACHE hits Ylegend[hits]: hits in 171.67.12.41 Options[hits]: gauge ShortLegend[hits]: hits MaxBytes[hits]: 5000000 Legend1[hits]: hits  LegendI[hits]: 5min  LegendO[hits]: 15min  WithPeak[hits]: ymwd Please, check the manpages to know which options you can put on Target value. mrtg-apache ----------- The web server which you want to monitor the hits must have the mod_info installed and properly configured. Here is an example: SetHandler server-info Order deny,allow Deny from all Allow from yourmrtghost.com This configuration allows the host yourmrtghost.com, where mrtg with mrtgutils is running, to query about the server information. Please, check the Apache webpage for more information: http://httpd.apache.org/docs/2.0/mod/mod_info.html -- Luciano Bello Fri, 24 Sep 2010 13:07:16 -0300 mrtgutils-0.8.1ubuntu1/debian/changelog0000664000000000000000000000753211634220040015061 0ustar mrtgutils (0.8.1ubuntu1) oneiric; urgency=low * Makefile: Correct placement of libs in linking. Fixes FTBFS. (LP: #770826) * mrtg-sensors.c: Fix missing include. -- Daniel T Chen Wed, 14 Sep 2011 17:38:49 -0400 mrtgutils (0.8.1) unstable; urgency=low * mrtgutils (>= 0.8) conflicts with mrtgutils (<=0.7). Closes:# 598799 -- Luciano Bello Wed, 06 Oct 2010 22:14:55 -0300 mrtgutils (0.8) experimental; urgency=low * New Standards-Version. * Debhelper version 8. * Tons of lintian issues cleaned. * mrtg-sensors is now present in amd64. Closes: #597253. * Migrate to libsensors4 and fixes in mrtg-sensors. Closes: #563556 Thanks to Norman Rasmussen! * mrtg-sensors is now in a separate package, called mrtgutils-sensors. Closes: #597254. * Other minor changes. -- Luciano Bello Thu, 23 Sep 2010 14:10:06 -0300 mrtgutils (0.7) unstable; urgency=low * The "It's time to grown up" release * New upstream developer, now is the packager, AKA me. Closes: #472730 * The strip in the Makefile was removed and just use dh_strip. Closes: #437586 * Many lintian issues cleaned. -- Luciano Bello Sat, 19 Apr 2008 23:00:09 -0300 mrtgutils (0.6) experimental; urgency=low * New maintainer (Closes:#352553). * Documentation extend in the README.Debian file (closes: #92924). * mrtg-ip-acct could also print packet counters of an interface and not only bytes. Thanks Mario Holbe for the patch. (closes: #218298). * Do not depends from libsensors3. The mrtg-sensors's run-dependencies are being ignored (Closes:#319226). Please, read README.Debian. -- Luciano Bello Thu, 14 Dec 2006 23:42:23 -0300 mrtgutils (0.5) unstable; urgency=low * Rebuilt with new libsensors to fix dependency. Closes: #237349 -- Randolph Chung Sun, 14 Mar 2004 23:49:40 -0800 mrtgutils (0.4-0.2) unstable; urgency=low * NMU * Rebuilt with new libsensors to fix dependency. Closes: #216854 -- Joey Hess Wed, 19 Nov 2003 13:05:22 -0500 mrtgutils (0.4-0.1) unstable; urgency=low * NMU * Rebuilt with new libsensors to fix dependency. Closes: #200766 * Should fix mrtg-sensors segfault. Closes: #192092 -- Joey Hess Sun, 24 Aug 2003 11:06:21 -0400 mrtgutils (0.4) unstable; urgency=low * oops, that patch doesn't work.. mrtg-sensors disappeared as a result. fixed now. (Closes: #98959, #99839) -- Randolph Chung Thu, 14 Jun 2001 22:04:12 -0700 mrtgutils (0.3) unstable; urgency=low * Following changes courtesy of Marcelo E. Magallon * debian/rules, Makefile: Use sensors only on i386 (closes: bug#88627) * debian/rules: add support for debug thingie in DEB_* enviroment variables. -- Randolph Chung Wed, 23 May 2001 21:58:37 -0700 mrtgutils (0.2) unstable; urgency=low * oops, left out the mrtg-sensors man page... * Allow user specification of status directory. Closes: #88409 * start using debian-native version numbers :) -- Randolph Chung Sun, 4 Mar 2001 19:08:32 -0700 mrtgutils (0.1-4) unstable; urgency=low * mrtg-sensors support from Joey Hess. Closes: #88436 -- Randolph Chung Sun, 4 Mar 2001 00:16:46 -0700 mrtgutils (0.1-3) unstable; urgency=low * Changed mrtg-ip-acct to use long long for the counters instead of long (for ultrasparc) (closes: #60642) -- Randolph Chung Fri, 17 Mar 2000 18:05:58 -0700 mrtgutils (0.1-2) unstable; urgency=low * Added a quiet option to mrtg-apache -- Randolph Chung Mon, 13 Mar 2000 23:13:43 -0700 mrtgutils (0.1-1) unstable; urgency=low * Initial Release. -- Randolph Chung Sat, 29 Jan 2000 21:37:16 -0700 mrtgutils-0.8.1ubuntu1/debian/rules0000775000000000000000000000245011447455076014306 0ustar #!/usr/bin/make -f #-*- makefile -*- # Made with the aid of dh_make, by Craig Small # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. # Some lines taken from debmake, by Christoph Lameter. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 CFLAGS = -O2 -Wall ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g endif build: build-stamp build-stamp: dh_testdir $(MAKE) CFLAGS="$(CFLAGS)" touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp install-stamp [ ! -f Makefile ] || $(MAKE) clean WITH_SENSORS=1 dh_clean install: install-stamp install-stamp: build-stamp dh_testdir dh_testroot dh_prep dh_installdirs -A usr/bin usr/share/man/man1 $(MAKE) install DESTDIR=$(CURDIR)/debian/mrtgutils mv debian/mrtgutils/usr/share/man/man1/mrtg-sensors.1.gz debian/mrtgutils-sensors/usr/share/man/man1 mv debian/mrtgutils/usr/bin/mrtg-sensors debian/mrtgutils-sensors/usr/bin touch install-stamp binary-indep: build install binary-arch: build install dh_testdir dh_testroot dh_installdocs dh_installman dh_installchangelogs dh_link dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install mrtgutils-0.8.1ubuntu1/mrtg-apache.pod0000664000000000000000000000144110540402430014652 0ustar =head1 NAME mrtg-apache - Returns the number of hits to a Apache web site =head1 SYNOPSIS mrtg-apache Ehost nameE [B<-p> port] [B<-m> multiplier] =head1 DESCRIPTION mrtg-apache uses the server-info capability (mod_info) of Apache to determine the number of hits to a web server. The output is written in a form useful as input for the mrtg utility. Ehost nameE is the name of the Apache host to contact. B<-p> is the port number to use. Default is 80. B<-m> is the multiplier to be used in the output. For example, with a multiplier of 100, if Apache returns 20 accesses, the output will be 2000. =head1 SEE ALSO mrtg(1) =head1 AUTHOR mrtg-apache was written by Randolph Chung Etausq@debian.orgE. =head1 HISTORY This document first appeared with mrtgutils-0.1 mrtgutils-0.8.1ubuntu1/Makefile0000664000000000000000000000151411634220114013421 0ustar CC = gcc CFLAGS = -g -O2 -Wall VERSION = 0.1 ARCH:= $(shell dpkg-architecture -qDEB_BUILD_ARCH) WITH_SENSORS:=1 COBJS = uptime.o util.o TARGETS = mrtg-load mrtg-ip-acct mrtg-apache MANPAGES = mrtg-load.1 mrtg-ip-acct.1 mrtg-apache.1 ifeq ($(WITH_SENSORS),1) TARGETS += mrtg-sensors MANPAGES += mrtg-sensors.1 endif %.o: %.c $(CC) $(CFLAGS) -c $< %.1: %.pod pod2man --center "MRTG helper utilities" --release "mrtgutils $(VERSION)" $^ > $@ all: $(TARGETS) $(MANPAGES) mrtg-sensors: LIBS=-lsensors mrtg-%: $(COBJS) mrtg-%.o $(CC) $(CFLAGS) -o $@ $^ $(LIBS) install: $(TARGET) for i in $(TARGETS); do install -m 755 $$i $(DESTDIR)/usr/bin/$$i; done for i in $(MANPAGES); do install -m 644 $$i $(DESTDIR)/usr/share/man/man1/$$i; gzip -9 $(DESTDIR)/usr/share/man/man1/$$i; done clean: -rm -f *.o $(TARGETS) $(MANPAGES) -rm -f *~ mrtgutils-0.8.1ubuntu1/uptime.h0000664000000000000000000000016107041735375013453 0ustar #ifndef UPTIME_H #define UPTIME_H void loadavg (double *, double *, double *); void print_uptime(void); #endif mrtgutils-0.8.1ubuntu1/mrtg-load.c0000664000000000000000000000073607044743657014046 0ustar #include "uptime.h" #include "util.h" #include #include #include int main(int argc, char **argv) { double avg; int c, mult = 1; loadavg(0, &avg, 0); while ((c = getopt(argc, argv, "m:")) > 0) { switch (c) { case 'm': mult = atoi(optarg); break; default: fprintf(stderr, "Usage: mrtg-load [-m multiplier]\n"); return(0); } } printf("0\n%.0f\n", avg*mult); print_uptime(); print_hostname(); return 0; }