projects
/
gnucomo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9f6fdbc
)
Exit without reading any input if the database connection fails.
author
arjen
<arjen>
Sat, 29 Mar 2003 08:42:00 +0000
(08:42 +0000)
committer
arjen
<arjen>
Sat, 29 Mar 2003 08:42:00 +0000
(08:42 +0000)
src/gcm_input/gcm_input.cpp
patch
|
blob
|
history
diff --git
a/src/gcm_input/gcm_input.cpp
b/src/gcm_input/gcm_input.cpp
index
d8bdb8a
..
9e47d48
100644
(file)
--- a/
src/gcm_input/gcm_input.cpp
+++ b/
src/gcm_input/gcm_input.cpp
@@
-7,7
+7,7
@@
***********************
** FILE NAME : gcm_input.cpp
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
***********************
** FILE NAME : gcm_input.cpp
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.
3
$
+** VERSION NUMBER : $Revision: 1.
4
$
**
** DESCRIPTION : Application to store client messages into the database
** The client message contains a log file from one of the
**
** DESCRIPTION : Application to store client messages into the database
** The client message contains a log file from one of the
@@
-47,13
+47,16
@@
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Aug 29, 2002
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Aug 29, 2002
-** LAST UPDATE :
Nov 04, 2002
+** LAST UPDATE :
Mar 28, 2003
** MODIFICATIONS :
**************************************************************************/
/*****************************
$Log: gcm_input.cpp,v $
** MODIFICATIONS :
**************************************************************************/
/*****************************
$Log: gcm_input.cpp,v $
- Revision 1.3 2002-11-09 08:04:27 arjen
+ Revision 1.4 2003-03-29 08:42:00 arjen
+ Exit without reading any input if the database connection fails.
+
+ Revision 1.3 2002/11/09 08:04:27 arjen
Added a reference to the GPL
Revision 1.2 2002/11/04 10:13:36 arjen
Added a reference to the GPL
Revision 1.2 2002/11/04 10:13:36 arjen
@@
-64,7
+67,7
@@
*****************************/
*****************************/
-static const char *RCSID = "$Id: gcm_input.cpp,v 1.
3 2002-11-09 08:04:27
arjen Exp $";
+static const char *RCSID = "$Id: gcm_input.cpp,v 1.
4 2003-03-29 08:42:00
arjen Exp $";
#include <getopt.h>
#include <getopt.h>
@@
-91,7
+94,7
@@
static char *Version = "gcm_input version 0.0.4 - Nov 05, 2002";
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
-** LAST MODIFIED :
Sep 30, 2002
+** LAST MODIFIED :
Mar 28, 2003
**=========================================================================
*/
**=========================================================================
*/
@@
-109,7
+112,7
@@
int main(int argc, char *argv[])
String hostname(""), service("");
int option;
String hostname(""), service("");
int option;
-
+
while ((option = getopt(argc, argv, "c:h:d:s:TvV")) != -1)
{
switch (option)
while ((option = getopt(argc, argv, "c:h:d:s:TvV")) != -1)
{
switch (option)
@@
-153,7
+156,6
@@
int main(int argc, char *argv[])
exit(1);
}
}
exit(1);
}
}
-
if (verbose)
{
std::cout << "Hostname = " << hostname;
if (verbose)
{
std::cout << "Hostname = " << hostname;
@@
-178,13
+180,21
@@
int main(int argc, char *argv[])
gnucomo_database db(&cfg);
gnucomo_database db(&cfg);
- client_message msg(&std::cin, db);
+ if (db.is_connected())
+ {
+
+ client_message msg(&std::cin, db);
- if (msg.classify(hostname, arrival, service) > 0.9)
+ if (msg.classify(hostname, arrival, service) > 0.9)
+ {
+ msg.enter();
+ }
+ return 0;
+ }
+ else
{
{
- msg.enter();
+ std::cerr << "gcm_input: Can not connect to database.\n";
+ return 1;
}
}
-
- return 0;
}
}