glite-lb-mon-db moved from utils to server
authorJan Pospíšil <honik@ntc.zcu.cz>
Sun, 10 Jun 2007 18:39:06 +0000 (18:39 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Sun, 10 Jun 2007 18:39:06 +0000 (18:39 +0000)
org.glite.lb.server/Makefile
org.glite.lb.server/doc/glite-lb-mon-db.1 [moved from org.glite.lb.utils/doc/glite-lb-mon-db.1 with 100% similarity]
org.glite.lb.server/src/mon-db.c [moved from org.glite.lb.utils/src/mon-db.c with 92% similarity]
org.glite.lb.utils/Makefile
org.glite.lb.utils/doc/README.LB-monitoring

index 1e09780..a9938e0 100644 (file)
@@ -8,7 +8,6 @@ package=glite-lb-server
 version=0.2.0
 PREFIX=/opt/glite
 
-glite_location=/opt/glite
 globus_prefix=/opt/globus
 nothrflavour=gcc32
 thrflavour=gcc32pthr
@@ -62,9 +61,9 @@ YACC=bison -y
 CC=gcc
 
 ifeq ($(gsoap_version),2.7.0)
-       VPATH=${top_srcdir}/interface:${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/project:${gsoap_prefix}
+       VPATH=${top_srcdir}/interface:${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/doc:${top_srcdir}/examples:${top_srcdir}/project:${gsoap_prefix}
 else
-       VPATH=${top_srcdir}/interface:${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/project
+       VPATH=${top_srcdir}/interface:${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/doc:${top_srcdir}/examples:${top_srcdir}/project
 endif
 AT3=${stagedir}/sbin/glite-lb-at3
 
@@ -100,6 +99,7 @@ ifdef LB_PROF
 else
        SRVBONES_LIB:= -L${stagedir}/lib -lglite_lb_server_bones
        LB_COMMON_LIB:=-lglite_lb_common_${nothrflavour}
+       LDFLAGS:= -L${stagedir}/lib
 endif
 
 ifdef LBS_DB_PROFILE
@@ -112,7 +112,7 @@ TEST_INC:=-I${cppunit_prefix}/include
 COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
 LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib  ${LDFLAGS} 
 SOLINK:=libtool --mode=link ${CC} -module ${LDFLAGS} -rpath ${stagedir}/lib
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} 
+# XXX: not used? LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} 
 INSTALL:=libtool --mode=install install
 LINKXX:=libtool --mode=link  ${CXX} -rpath ${stagedir}/lib ${LDFLAGS}
 XSLTPROC:=xsltproc --novalid
@@ -232,13 +232,19 @@ WS_CLIENT_LIBS:= ${GSOAP_LIB} -lglite_lb_common_${nothrflavour} \
 
 HDRS=index.h lb_authz.h lbs_db.h store.h
 
+MAN_GZ:=glite-lb-mon-db.1.gz
+MAN = $(MAN_GZ:.gz=)
+
 LIB_OBJS_BK:= \
        il_lbproxy.o get_events.o index.o jobstat.o jobstat_supp.o process_event.o process_event_pbs.o process_event_condor.o \
        seqcode.o lbs_db.o lbs_db_supp.o lb_html.o lb_http.o lb_proto.o lb_xml_parse.o \
        lb_xml_parse_V21.o \
        lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \
        stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \
-       notification.o il_notification.o notif_match.o stats.o
+       notification.o il_notification.o notif_match.o stats.o write2rgma.o
+
+MONDB_OBJS:=mon-db.o ${LIB_OBJS_BK}
+MONDB_LIBS:=${COMMON_LIBS} ${EXT_LIBS} 
 
 glite-lb-bkserverd: ${NSMAP} ${BKSERVER_OBJS}
        ${LINKXX} -o $@ ${BKSERVER_OBJS} ${BKSERVER_LIBS}
@@ -249,7 +255,8 @@ glite-lb-bkindex: ${INDEX_OBJS}
 glite_lb_plugin.la: ${PLUGIN_LOBJS}
        ${SOLINK} -o $@ ${PLUGIN_LOBJS} ${PLUGIN_LIBS}
 
-default all: compile
+glite-lb-mon-db: ${MONDB_OBJS}
+       ${LINKXX} -o $@ ${MONDB_OBJS} ${MONDB_LIBS}
 
 ifdef LB_STANDALONE
     PLUGIN_LIB=
@@ -261,8 +268,9 @@ else
 endif
 endif
 
-compile: glite-lb-bkserverd glite-lb-bkindex ${STATIC_LIB_BK} ${PLUGIN_LIB} store.c index.c jp_job_attrs.h
+compile: generate glite-lb-bkserverd glite-lb-bkindex glite-lb-mon-db ${STATIC_LIB_BK} ${PLUGIN_LIB} ${MAN_GZ}
 
+generate: store.c index.c jp_job_attrs.h
 
 check: compile test.xml test.query
        -echo check.query not complete yet
@@ -331,7 +339,6 @@ ws_query_ex: ws_query_ex.o ${WS_CLIENT_OBJS}
 ws_joblog: ws_joblog.o ${WS_CLIENT_OBJS}
        ${LINK} -o $@ ws_joblog.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
 
-
 ${STATIC_LIB_BK}: ${LIB_OBJS_BK}
        ar crv $@ ${LIB_OBJS_BK}
        ranlib $@
@@ -339,7 +346,11 @@ ${STATIC_LIB_BK}: ${LIB_OBJS_BK}
 jp_job_attrs.h: job-attrs.xsd jp_job_attrs.xsl 
        ${XSLTPROC} ../src/jp_job_attrs.xsl $< >$@
 
-doc:
+doc: ${MAN_GZ}
+
+${MAN_GZ}: ${MAN}
+       cp $? .
+       gzip -f $(notdir $?)
 
 stage: compile
        $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes
@@ -360,10 +371,12 @@ distbin:
 install:
        -mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/etc/init.d ${PREFIX}/interface
        -mkdir -p ${PREFIX}/share/doc/${package}-${version}
+       -mkdir -p ${PREFIX}/share/man/man1
        -mkdir -p ${PREFIX}/lib
        -mkdir -p ${PREFIX}/include/${globalprefix}/${lbprefix}
        ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
-       for p in bkserverd bkindex; do \
+       ${INSTALL} -m 644 ${MAN_GZ} ${PREFIX}/share/man/man1
+       for p in bkserverd bkindex mon-db; do \
                ${INSTALL} -m 755 "glite-lb-$$p" "${PREFIX}/bin/glite-lb-$$p"; \
        done
 
similarity index 92%
rename from org.glite.lb.utils/src/mon-db.c
rename to org.glite.lb.server/src/mon-db.c
index 1478659..2edcdc9 100644 (file)
 
 static struct option opts[] = {
        { "mysql",1,NULL,'m' },
+       { "debug",0,NULL,'d' },
        { "verbose",0,NULL,'v' },
        { NULL, 0, NULL, 0 }
 };
 
+int debug  = 0;
+
 static void usage();
 static void do_exit(edg_wll_Context,int);
 static const char *me;
@@ -37,8 +40,9 @@ int main(int argc,char **argv)
 
        me = strdup(argv[0]);
 
-       while ((opt = getopt_long(argc,argv,"m:v",opts,NULL)) != EOF) switch (opt) {
+       while ((opt = getopt_long(argc,argv,"m:dv",opts,NULL)) != EOF) switch (opt) {
                case 'm': dbstring = optarg; break;
+               case 'd': debug++; verbose++; break;
                case 'v': verbose++; break;
                case '?': usage(); exit(EX_USAGE);
        }
@@ -90,6 +94,7 @@ static void usage()
 {
        fprintf(stderr,"usage: %s <options>\n"
                        "       -m,--mysql <dbstring>   use non-default database connection\n"
+                       "       -d,--debug              print debug info (if any)\n",
                        "       -v,--verbose            be verbose\n",
                        me);
 }
index df16b5c..2db2051 100644 (file)
@@ -66,9 +66,9 @@ CLIENT_LIB:=-lglite_lb_client_${nothrflavour}
 BKSERVER_LIB:=-lglite_lb_bkserver 
 JP_LIBS:=-lglite_jp_common_${nothrflavour} -lglite_jp_trio
 
-UTILS:=statistics mon mon-db
+UTILS:=statistics mon 
 
-MAN_GZ:=glite-lb-mon.1.gz glite-lb-mon-db.1.gz
+MAN_GZ:=glite-lb-mon.1.gz
 MAN = $(MAN_GZ:.gz=)
 
 
@@ -82,9 +82,6 @@ compile all: ${UTILS} ${MAN_GZ}
 mon: mon.o
        ${LINK} -o $@ $< ${COMMON_LIB} ${CLIENT_LIB} ${EXT_LIBS} 
 
-mon-db: mon-db.o
-       ${LINK} -o $@ $< ${COMMON_LIB} ${BKSERVER_LIB} ${EXT_LIBS} 
-
 statistics: statistics.o
        ${LINK} -rdynamic -o $@ $< ${COMMON_LIB} ${JP_LIBS} ${EXT_LIBS} 
 
@@ -130,7 +127,8 @@ install:
        fi
 
 clean:
-       rm -fv ${UTILS} ${MAN_GZ} *.{lo,o}
+       rm -rfv ${UTILS} ${MAN_GZ} *.{lo,o}
+       rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/
 
 %.o: %.c
        ${COMPILE} -c $<
index 868f5c9..a1900bc 100644 (file)
@@ -32,34 +32,3 @@ FILES
             [ type = "time"; name = "aborted" ],
             [ type = "time"; name = "cancelled" ],
 
-
-GLITE-LB-MON-DB
----------------
-NAME
-       glite-lb-mon-db - program for monitoring the number of jobs in the LB system
-
-SYNOPSIS
-       glite-lb-mon-db [-m dbstring]
-
-DESCRIPTION
-       glite-lb-mon-db  is a low-level program for monitoring the the number of jobs in the LB system.  Using the LB internals,
-       it connects directly to the underlying MySQL database and reads the number of jobs in each state.
-
-OPTIONS
-       -m dbstring, --mysql=dbstring
-              use non-default database connection string
-
-EXAMPLES
-       glite-lb-mon-db
-              this is the default usage
-
-       glite-lb-mon-db -m lbserver/@localhost:lbproxy
-              use this dbstring to query the LB Proxy database. WARNING: the data in the LB Proxy may be incomplete!
-
-ENVIRONMENT
-       MYSQL_UNIX_PORT
-              set this environment variable to specify the path to the non-default MySQL socket path
-
-       LBDB   you can set this environment variable as an alternative to specify the non-default database connection string
-
-