Hi all,

I just started using pmacct and it looks very nice. Thanks for all your hard work!

I discovered it by accident while searching for process accounting tools. It doesn't seem to be widely known. I have spent a lot of time searching for netflow probes and aggregation/graphing tools, and never found this one before.

I made a small patch that adds a "-q" option to pmacct, which removes the header and footer from the "-s" option. This makes it easier to work with in scripts. Please find attached.

I couldn't understand the "pmacct -t" option (memory table stats). It just prints incrementing numbers, seemingly forever, and when I kill the process with ^C, pmacctd stops talking to the pipe and needs to be restarted (potential DoS problem).

This line in pmacct.c:

  else if (want_erase) printf("OK: Clearing stats.\n");

prints a message but does nothing else. That doesn't seem very useful.

Cheers, Chris.
--
(aidworld) chris wilson | chief engineer (http://www.aidworld.org)
Only in pmacct-chris: config.cache
Only in pmacct-chris: config.log
Only in pmacct-chris: config.status
Only in pmacct-chris: Makefile
Only in pmacct-chris: pmacctd.conf
Only in pmacct-chris/src: acct.o
Only in pmacct-chris/src: addr.o
Only in pmacct-chris/src: bpf_filter.o
Only in pmacct-chris/src: cfg_handlers.o
Only in pmacct-chris/src: cfg.o
Only in pmacct-chris/src: classifier.o
Only in pmacct-chris/src: conntrack.o
Only in pmacct-chris/src: imt_plugin.o
Only in pmacct-chris/src: ip_flow.o
Only in pmacct-chris/src: ip_frag.o
Only in pmacct-chris/src: ll.o
Only in pmacct-chris/src: log.o
Only in pmacct-chris/src: Makefile
Only in pmacct-chris/src: memory.o
Only in pmacct-chris/src: net_aggr.o
Only in pmacct-chris/src: nfacctd
Only in pmacct-chris/src: nfacctd.o
Only in pmacct-chris/src/nfprobe_plugin: convtime.o
Only in pmacct-chris/src/nfprobe_plugin: libnfprobe_plugin.a
Only in pmacct-chris/src/nfprobe_plugin: Makefile
Only in pmacct-chris/src/nfprobe_plugin: netflow1.o
Only in pmacct-chris/src/nfprobe_plugin: netflow5.o
Only in pmacct-chris/src/nfprobe_plugin: netflow9.o
Only in pmacct-chris/src/nfprobe_plugin: nfprobe_plugin.o
Only in pmacct-chris/src/nfprobe_plugin: strlcat.o
Only in pmacct-chris/src: nfv8_handlers.o
Only in pmacct-chris/src: nfv9_template.o
Only in pmacct-chris/src: pkt_handlers.o
Only in pmacct-chris/src: plugin_hooks.o
Only in pmacct-chris/src: pmacct
diff -ru pmacct-0.11.0/src/pmacct.c pmacct-chris/src/pmacct.c
--- pmacct-0.11.0/src/pmacct.c  2006-06-26 14:24:23.000000000 +0100
+++ pmacct-chris/src/pmacct.c   2006-10-18 14:19:18.000000000 +0100
@@ -274,6 +274,7 @@
   fetch_from_file = FALSE;
   what_to_count = FALSE;
   have_wtc = FALSE;
+  int quiet_flag = FALSE;
 
   while (!errflag && ((cp = getopt(argc, argv, ARGS_PMACCT)) != -1)) {
     switch (cp) {
@@ -439,6 +440,9 @@
       q.type |= WANT_RESET;
       want_reset = TRUE;
       break;
+    case 'q':
+      quiet_flag = TRUE;
+      break;
     default:
       printf("ERROR: parameter %c unknown! \n  Exiting...\n\n", cp);
       usage_client(argv[0]);
@@ -777,7 +781,11 @@
       }
     }
 
-    write_stats_header(what_to_count, have_wtc);
+    if (!quiet_flag)
+    {
+      write_stats_header(what_to_count, have_wtc);
+    }
+
     elem = largebuf+sizeof(struct query_header);
     unpacked -= sizeof(struct query_header);
     while (printed < unpacked) {
@@ -865,7 +873,10 @@
       elem += sizeof(struct pkt_data);
       printed += sizeof(struct pkt_data);
     }
-    printf("\nFor a total of: %d entries\n", counter);
+    if (!quiet_flag)
+    {
+      printf("\nFor a total of: %d entries\n", counter);
+    }
   }
   else if (want_erase) printf("OK: Clearing stats.\n");
   else if (want_status) {
Only in pmacct-chris/src: pmacctd
diff -ru pmacct-0.11.0/src/pmacct-defines.h pmacct-chris/src/pmacct-defines.h
--- pmacct-0.11.0/src/pmacct-defines.h  2006-09-20 17:13:17.000000000 +0100
+++ pmacct-chris/src/pmacct-defines.h   2006-10-18 12:50:03.000000000 +0100
@@ -23,7 +23,7 @@
 #define ARGS_NFACCTD "n:dDhP:b:f:F:c:m:p:r:s:S:L:l:v:o:R"
 #define ARGS_SFACCTD "n:dDhP:b:f:F:c:m:p:r:s:S:L:l:v:o:R"
 #define ARGS_PMACCTD "n:NdDhP:b:f:F:c:i:I:m:p:r:s:S:v:o:wWL:"
-#define ARGS_PMACCT "Ssc:Cetm:p:P:M:arN:n:l"
+#define ARGS_PMACCT "Ssqc:Cetm:p:P:M:arN:n:l"
 #define N_PRIMITIVES 21
 #define N_FUNCS 10 
 #define MAX_N_PLUGINS 32
Only in pmacct-chris/src: pmacctd.o
Only in pmacct-chris/src: pmacct.o
Only in pmacct-chris/src: ports_aggr.o
Only in pmacct-chris/src: pretag_handlers.o
Only in pmacct-chris/src: pretag.o
Only in pmacct-chris/src: print_plugin.o
Only in pmacct-chris/src: regexp.o
Only in pmacct-chris/src: regsub.o
Only in pmacct-chris/src: server.o
Only in pmacct-chris/src: setproctitle.o
Only in pmacct-chris/src: sfacctd
Only in pmacct-chris/src: sfacctd.o
Only in pmacct-chris/src/sfprobe_plugin: libsfprobe_plugin.a
Only in pmacct-chris/src/sfprobe_plugin: Makefile
Only in pmacct-chris/src/sfprobe_plugin: sflow_agent.o
Only in pmacct-chris/src/sfprobe_plugin: sflow_poller.o
Only in pmacct-chris/src/sfprobe_plugin: sflow_receiver.o
Only in pmacct-chris/src/sfprobe_plugin: sflow_sampler.o
Only in pmacct-chris/src/sfprobe_plugin: sfprobe_plugin.o
Only in pmacct-chris/src: signals.o
Only in pmacct-chris/src: strlcpy.o
Only in pmacct-chris/src: util.o
Only in pmacct-chris/src: xflow_status.o
_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Reply via email to