[dvblast-devel] dvblast loggin to syslog

Georgi Chorbadzhiyski gf at unixsol.org
Thu Aug 25 16:11:43 CEST 2011


/Please use reply-to-all otherwise you are losing CC addresses/

Around 08/25/2011 04:34 PM, Вячеслав Адаманов scribbled:
> Because in this case for monitoring multiple installations dvblast easier to
> collect and parse status and counters information on one remote syslog
> server.

With the attached patch I get this in syslog.

Aug 25 17:08:30 dvbs2 ./test-test-test[7825]: DVBlast 2.0.0-svn
Aug 25 17:08:31 dvbs2 ./test-test-test[7825]: info: frontend has acquired lock
Aug 25 17:08:40 dvbs2 ./test-test-test[7825]: info: MRTG: 69082292 5 89 349676
Aug 25 17:08:50 dvbs2 ./test-test-test[7825]: info: MRTG: 143932612 5 89 728547

/the dvblast binary is symlinked to ./test-test-test/

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
-------------- next part --------------
diff --git a/mrtg-cnt.c b/mrtg-cnt.c
index 258bf64..ae457b4 100644
--- a/mrtg-cnt.c
+++ b/mrtg-cnt.c
@@ -62,14 +62,18 @@ static signed char i_pid_seq[PIDS];
 // Report the mrtg counters: bytes received, error packets & sequence errors
 static void dumpCounts()
 {
+    char data[128];
     unsigned int multiplier = 1;        //MRTG_INTERVAL;
     if(mrtg_fh) {
         rewind(mrtg_fh);
-        fprintf(mrtg_fh, "%lld %lld %lld %lld\n",
+        snprintf(data, sizeof(data) - 1, "%lld %lld %lld %lld\n",
                 l_mrtg_packets * 188 * multiplier,
                 l_mrtg_error_packets * multiplier,
                 l_mrtg_seq_err_packets * multiplier,
                 l_mrtg_scram_packets * multiplier);
+        data[sizeof(data) - 1] = '\0';
+        fprintf( mrtg_fh, "%s\n", data );
+        msg_Info( NULL , "MRTG: %s", data );
         fflush(mrtg_fh);
     }
 }


More information about the dvblast-devel mailing list