Added a new filter which can directly read the output
[gnucomo.git] / src / gcm_input / gcm_input.cpp
index b1c50e6..bcce2e8 100644 (file)
@@ -7,7 +7,7 @@
 ***********************
 **      FILE NAME      : gcm_input.cpp
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.13 $
+**      VERSION NUMBER : $Revision: 1.14 $
 **
 **  DESCRIPTION      :  Application to store client messages into the database
 **                      The client message contains a log file from one of the
 
 /*****************************
    $Log: gcm_input.cpp,v $
-   Revision 1.13  2003-12-22 10:20:21  arjen
+   Revision 1.14  2007-11-03 10:26:13  arjen
+   Added a new filter which can directly read the output
+   of the UNIX df command. A brief description is added in
+   the user manual.
+
+   Revision 1.13  2003/12/22 10:20:21  arjen
    Report if the message type can not be detected.
 
    Revision 1.12  2003/12/04 10:38:09  arjen
 
 *****************************/
 
-static const char *RCSID = "$Id: gcm_input.cpp,v 1.13 2003-12-22 10:20:21 arjen Exp $";
+static const char *RCSID = "$Id: gcm_input.cpp,v 1.14 2007-11-03 10:26:13 arjen Exp $";
 
 #include <fstream>
 
@@ -122,6 +127,7 @@ static const char *RCSID = "$Id: gcm_input.cpp,v 1.13 2003-12-22 10:20:21 arjen
 #include "message.h"
 #include "log_filter.h"
 #include "rpm_filter.h"
+#include "df_filter.h"
 
 #include "xml_cooker.h"
 #include "syslog_cooker.h"
@@ -134,7 +140,7 @@ bool testmode = false;
 bool incremental = false;
 std::ostream *Log = &std::cerr;
 
-static char *Version = "gcm_input version 0.0.9 - Dec 22, 2003";
+static char *Version = "gcm_input version 0.0.11 - Nov 22, 2007";
 
 
 /*=========================================================================
@@ -272,9 +278,12 @@ int main(int argc, char *argv[])
 
       client_message      msg(&std::cin, db);
 
+      double              message_probability;
+
       message_filter      shortcircuit(hostname, arrival, service);
       log_filter          lf(hostname, arrival, service);
       rpm_filter          rf(hostname, arrival, service);
+      df_filter           df(hostname, arrival, service);
 
       syslog_cooker       slc;
       irix_syslog_cooker  islc;
@@ -282,6 +291,7 @@ int main(int argc, char *argv[])
       error_cooker        elc;
       xml_cooker          xlc;
       rpm_cooker          rlc;
+      df_cooker           dlc;
 
       msg.add_cooker(&xlc,  &shortcircuit);
       msg.add_cooker(&slc,  &lf);
@@ -289,8 +299,11 @@ int main(int argc, char *argv[])
       msg.add_cooker(&alc,  &lf);
       msg.add_cooker(&elc,  &lf);
       msg.add_cooker(&rlc,  &rf);
+      msg.add_cooker(&dlc,  &df);
 
-      if (msg.classify(hostname, arrival, service) > 0.9)
+      message_probability = msg.classify(hostname, arrival, service);
+      *Log << "Message type probability = " << message_probability << "\n";
+      if (message_probability > 0.75)
       {
          try
          {