]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/misc-progs/monitorTraff.c
1 /* Addon helper program - monitorTraff
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
6 * Copyright (c) Achim Weber 2 November 2006
8 * Wrapper for Perl Monitoring script
10 * $Id: monitorTraff.c,v 1.4 2006/11/15 17:53:43 dotzball Exp $
19 /* define parameters */
20 #define PARA_TEST "--testEmail"
21 #define PARA_WARN "--warnEmail"
22 #define PARA_FORCE "--force"
24 struct keyvalue
*kv
= NULL
;
28 fprintf (stderr
, "Usage:\n");
29 fprintf (stderr
, "\tmonitorTraff [PARAMETER]\n");
30 fprintf (stderr
, "\t\tWhen called without parameter, monitorTraff calculates the traffic.\n");
31 fprintf (stderr
, "\t\tPARAMETER:\n");
32 fprintf (stderr
, "\t\t\t--testEmail : Send a test email\n");
33 fprintf (stderr
, "\t\t\t--warnEmail : Send a warn email\n");
34 fprintf (stderr
, "\t\t\t--force : Force re-calculation\n");
37 int main(int argc
, char *argv
[])
39 char buffer
[STRING_SIZE
];
48 safe_system("/usr/local/bin/monitorTraffic.pl");
51 && (strcmp(argv
[1], PARA_TEST
)==0
52 || strcmp(argv
[1], PARA_WARN
)==0
53 || strcmp(argv
[1], PARA_FORCE
)==0) )
55 // send (test|warn) Email or force re-calc
56 memset(buffer
, 0, STRING_SIZE
);
57 if ( snprintf(buffer
, STRING_SIZE
- 1, "/usr/local/bin/monitorTraffic.pl %s", argv
[1]) >= STRING_SIZE
)
59 fprintf(stderr
, "Command too long\n");