File: mrtg-load.c

package info (click to toggle)
mrtgutils 0.5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 80 kB
  • ctags: 34
  • sloc: ansic: 327; makefile: 73
file content (26 lines) | stat: -rw-r--r-- 478 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "uptime.h"
#include "util.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

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;
}