From: <jc...@us...> - 2006-11-29 23:25:05
|
Revision: 407 http://svn.sourceforge.net/omc/?rev=407&view=rev Author: jcarey Date: 2006-11-29 15:25:03 -0800 (Wed, 29 Nov 2006) Log Message: ----------- Broke out the xml service providers and placed them in the new contrib area Added Paths: ----------- contrib/ contrib/xml-service-provider/ contrib/xml-service-provider/branches/ contrib/xml-service-provider/tags/ contrib/xml-service-provider/trunk/ contrib/xml-service-provider/trunk/AUTHORS contrib/xml-service-provider/trunk/COPYING contrib/xml-service-provider/trunk/ChangeLog contrib/xml-service-provider/trunk/INSTALL contrib/xml-service-provider/trunk/LICENSE contrib/xml-service-provider/trunk/Makefile.am contrib/xml-service-provider/trunk/Makefile.incl.am contrib/xml-service-provider/trunk/NEWS contrib/xml-service-provider/trunk/README contrib/xml-service-provider/trunk/bootstrap.sh contrib/xml-service-provider/trunk/configure.ac contrib/xml-service-provider/trunk/example-services/ contrib/xml-service-provider/trunk/example-services/Makefile.am contrib/xml-service-provider/trunk/example-services/apache/ contrib/xml-service-provider/trunk/example-services/apache/Apache.xml contrib/xml-service-provider/trunk/example-services/apache/Makefile.am contrib/xml-service-provider/trunk/example-services/apache/how-to.txt contrib/xml-service-provider/trunk/example-services/apache/httpdstat.awk contrib/xml-service-provider/trunk/install-sh contrib/xml-service-provider/trunk/mof/ contrib/xml-service-provider/trunk/mof/Makefile.am contrib/xml-service-provider/trunk/mof/xml-service.mof contrib/xml-service-provider/trunk/src/ contrib/xml-service-provider/trunk/src/Makefile.am contrib/xml-service-provider/trunk/src/XMLServiceProvider.cpp contrib/xml-service-provider/trunk/src/XMLServiceProvider.hpp contrib/xml-service-provider/trunk/src/XMLServiceProviderNonRes.cpp contrib/xml-service-provider/trunk/src/servicexml/ contrib/xml-service-provider/trunk/src/servicexml/ConfigTool.cpp contrib/xml-service-provider/trunk/src/servicexml/ConfigTool.hpp contrib/xml-service-provider/trunk/src/servicexml/HealthDataItem.cpp contrib/xml-service-provider/trunk/src/servicexml/HealthDataItem.hpp contrib/xml-service-provider/trunk/src/servicexml/Makefile.am contrib/xml-service-provider/trunk/src/servicexml/ProcessInfo.cpp contrib/xml-service-provider/trunk/src/servicexml/ProcessInfo.hpp contrib/xml-service-provider/trunk/src/servicexml/ServiceXMLParser.cpp contrib/xml-service-provider/trunk/src/servicexml/ServiceXMLParser.hpp contrib/xml-service-provider/trunk/src/servicexml/XMLSvcUtils.cpp contrib/xml-service-provider/trunk/src/servicexml/XMLSvcUtils.hpp contrib/xml-service-provider/trunk/xmlschema/ contrib/xml-service-provider/trunk/xmlschema/Makefile.am contrib/xml-service-provider/trunk/xmlschema/xml-service-provider.xsd contrib/xml-service-provider/trunk/xmlservice.spec Added: contrib/xml-service-provider/trunk/AUTHORS =================================================================== Added: contrib/xml-service-provider/trunk/COPYING =================================================================== Added: contrib/xml-service-provider/trunk/ChangeLog =================================================================== --- contrib/xml-service-provider/trunk/ChangeLog (rev 0) +++ contrib/xml-service-provider/trunk/ChangeLog 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1 @@ +Initial. Added: contrib/xml-service-provider/trunk/INSTALL =================================================================== --- contrib/xml-service-provider/trunk/INSTALL (rev 0) +++ contrib/xml-service-provider/trunk/INSTALL 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,229 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + Added: contrib/xml-service-provider/trunk/LICENSE =================================================================== --- contrib/xml-service-provider/trunk/LICENSE (rev 0) +++ contrib/xml-service-provider/trunk/LICENSE 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,31 @@ +/****************************************************************************** +* Copyright (c) [YEARS], Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of the Novell nor the names of its contributors may be +* used to endorse or promote products derived from this software without +* specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +******************************************************************************/ + Added: contrib/xml-service-provider/trunk/Makefile.am =================================================================== --- contrib/xml-service-provider/trunk/Makefile.am (rev 0) +++ contrib/xml-service-provider/trunk/Makefile.am 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,11 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = gnu + +SUBDIRS = \ + . \ + src \ + example-services \ + mof \ + xmlschema + Added: contrib/xml-service-provider/trunk/Makefile.incl.am =================================================================== --- contrib/xml-service-provider/trunk/Makefile.incl.am (rev 0) +++ contrib/xml-service-provider/trunk/Makefile.incl.am 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,11 @@ +# *********************************************************************** +# MACROS and VARIABLES +# *********************************************************************** + +providerdir = $(libdir)/openwbem/c++providers + + +# *********************************************************************** +# TARGETS +# *********************************************************************** + Added: contrib/xml-service-provider/trunk/NEWS =================================================================== --- contrib/xml-service-provider/trunk/NEWS (rev 0) +++ contrib/xml-service-provider/trunk/NEWS 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1 @@ + Added: contrib/xml-service-provider/trunk/README =================================================================== Added: contrib/xml-service-provider/trunk/bootstrap.sh =================================================================== --- contrib/xml-service-provider/trunk/bootstrap.sh (rev 0) +++ contrib/xml-service-provider/trunk/bootstrap.sh 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,9 @@ +#!/bin/sh + +rm -rf config.cache config.guess config.sub depcomp missing mkinstalldirs autom4te.cache + +aclocal \ +&& autoconf \ +&& autoheader \ +&& libtoolize --force --copy \ +&& automake --add-missing Property changes on: contrib/xml-service-provider/trunk/bootstrap.sh ___________________________________________________________________ Name: svn:executable + * Added: contrib/xml-service-provider/trunk/configure.ac =================================================================== --- contrib/xml-service-provider/trunk/configure.ac (rev 0) +++ contrib/xml-service-provider/trunk/configure.ac 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,159 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.57) +AC_INIT(openwbem-xmlservice-providers, 1.0.0) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([src]) +AC_CONFIG_HEADER([config.h]) +AC_PROG_LIBTOOL + +AC_PREFIX_DEFAULT(/usr) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_LEX +AC_PROG_YACC + +AC_PATH_PROG(RM, rm, rm) +AC_PATH_PROG(MV, mv, mv) +AC_PATH_PROG(CP, cp, cp) + +DEBUG_FLAGS="-DDEBUG -g" # Additional debugging flags. +FULL_DEBUG_FLAGS="-D_GLIBCXX_DEBUG" # Additional debugging flags. +OPT_FLAGS=" -DNDEBUG -O2" # Additional optimization flags. + +##NOTE: whereever CXXFLAGS is used, we need to also use CPPFLAGS, for the AC_CHECK_HEADERS - +## It now uses compile (primarily) but still uses pre-processor for interim transition / backward compatibility +## pre-processor needs the CPPFLAGS + + +####################################################################### +# set the location of the sysconf dir +if test "x$sysconfdir" != "x\${prefix}/etc"; then + tempDir=$sysconfdir +else + if test "x$prefix" != "xNONE"; then + tempDir=${prefix}/etc + else + tempDir=${ac_default_prefix}/etc + fi +fi + +AC_DEFINE_UNQUOTED(XMLSVC_SYSCONF_DIR, "${tempDir}", "Default sysconfig dir") + +####################################################################### +# Process additional search dirs if specified +AC_ARG_WITH(search-dir, + [ --with-search-dir=PATH Specify an additional directory to look for include/ and lib/ sub dirs ], + [ + if test "x$withval" != "xno" ; then + CXXFLAGS="$CXXFLAGS -I$withval/include" + CPPFLAGS="$CPPFLAGS -I$withval/include" + CFLAGS="$CFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + fi + ] +) + +debuglevel="0" +####################################################################### +# Set the debug flag if specified +AC_ARG_ENABLE(debug-mode, + [--enable-debug-mode Enable debugging mode], + [ + debuglevel="1" + ] +) + +AC_ARG_WITH(debug-level, + [ --with-debug-level=LEVEL Specify a debug level valid values: 0=none 1=partial debug 2=full debug ], + [ + case "x$withval" in + x0|xno) + debuglevel="0";; + x1) + debuglevel="1";; + x2) + debuglevel="2";; + *) + AC_MSG_WARN("Invalid debug level specified. Valid values are 0, 1 or 2") + exit 1;; + esac + ] +) + +case $debuglevel in +1) + AC_DEFINE(SMASH_DEBUG, 1, "Debugging flag.") + CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall" + CPPFLAGS="$CPPFLAGS $DEBUG_FLAGS -Wall" + CFLAGS=" $CFLAGS $DEBUG_FLAGS -Wall" + LDFLAGS=" $LDFLAGS $DEBUG_FLAGS";; +2) + AC_DEFINE(SMASH_DEBUG, 2, "Debugging flag.") + CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS $FULL_DEBUG_FLAGS -Wall" + CPPFLAGS="$CPPFLAGS $DEBUG_FLAGS $FULL_DEBUG_FLAGS -Wall" + CFLAGS=" $CFLAGS $DEBUG_FLAGS $FULL_DEBUG_FLAGS -Wall" + LDFLAGS=" $LDFLAGS $DEBUG_FLAGS $FULL_DEBUG_FLAGS";; +*) + CXXFLAGS="$CXXFLAGS $OPT_FLAGS -Wall" + CPPFLAGS="$CPPFLAGS $OPT_FLAGS -Wall" + CFLAGS=" $CFLAGS $OPT_FLAGS -Wall" + LDFLAGS=" $LDFLAGS $OPT_FLAGS";; +esac + +##################################################### + +# Checks for two basic and common openwbem libraries +AC_CHECK_LIB([owcimomcommon], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +AC_CHECK_LIB([owclient], [main], [LIBS="$LIBS"], [AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) + +# Check for omcbase library +#AC_CHECK_LIB([omcbase], [main], [LIBS="$LIBS"], [AC_MSG_ERROR(Must have openwbem-base-providers-devel or build will fail)]) + +# Checks for header files. +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([openwbem/OW_config.h fcntl.h stdlib.h string.h unistd.h sys/time.h openssl/evp.h sys/param.h sys/vfs.h],,[AC_MSG_ERROR(Missing headers: likely won't compile)]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_UID_T +AC_HEADER_TIME +AC_TYPE_MODE_T +AC_TYPE_SIGNAL +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_FUNC_CLOSEDIR_VOID +AC_REPLACE_FNMATCH +AC_FUNC_FORK +AC_FUNC_LSTAT +AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_FUNC_CHOWN +AC_FUNC_SETVBUF_REVERSED +AC_FUNC_STAT +AC_FUNC_STRERROR_R + +AC_CHECK_FUNCS([gettimeofday memset regcomp strchr strdup strerror strstr strtol strtoul uname]) + +AC_CONFIG_FILES([Makefile + src/Makefile + src/servicexml/Makefile + example-services/Makefile + example-services/apache/Makefile + mof/Makefile + xmlschema/Makefile + ]) +AC_OUTPUT Added: contrib/xml-service-provider/trunk/example-services/Makefile.am =================================================================== --- contrib/xml-service-provider/trunk/example-services/Makefile.am (rev 0) +++ contrib/xml-service-provider/trunk/example-services/Makefile.am 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1 @@ +SUBDIRS = apache Added: contrib/xml-service-provider/trunk/example-services/apache/Apache.xml =================================================================== --- contrib/xml-service-provider/trunk/example-services/apache/Apache.xml (rev 0) +++ contrib/xml-service-provider/trunk/example-services/apache/Apache.xml 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,250 @@ +<?xml version="1.0"?> +<!-- +Sample Service Description XML Document. + +This file should be placed in /etc/omc/svcinfo.d +It should be named <service name>.xml. The reason for the naming scheme, +is that other services can refer to this service in their dependency list using +the file name minus the '.xml' extension. + +Note: The name of the service is the name of this file without the .xml +file extension. + --> + +<serviceDescription version="1.0"> + + <!-- Caption for display purposes --> + <caption>Apache Web Server</caption> + + <!-- Description of this service --> + <description> + Apache is an open source web server that runs on most commonly used + platforms. Apache has a modular design that provide a variety of + services such as server-side scripting. + </description> + + <!-- + The configurationTool tag allows you to specify a method of + configuring the service. Many congifuration tags may be + specified. The format of the uri element needs to be + specified by the developers that are implementing the + console application that consumes health. + + type = web|c1|script|text_console|xwindows|windows + --> + <configurationTool> + <type>web</type> + <name>AddVirtualServer</name> + <description>Add a virtual host to the server</description> + <uri> + http://www.AddVirtualServer.com + </uri> + </configurationTool> + + <configurationTool> + <type>web</type> + <name>EnableModule</name> + <description>Enable an Apache module</description> + <uri> + http://www.EnableModule.com + </uri> + </configurationTool> + + <!-- + Define the services that this service has a dependency on. + There must be a corresponding Service Description XML file + for the antecedent service in the /etc/omc/svcinfo.d directory. + --> + <dependsOn> + <serviceName>Service1-That-Apache-Depends-On</serviceName> + <serviceName>Service2-That-Apache-Depends-On</serviceName> + </dependsOn> + + <!-- + The startCommand tag specifies the command line that will be + invoked to start the service. The return code from this command + must be as follows: + 0 - success + 1 - generic or unspecified error + 2 - invalid or excess argument(s) + 3 - unimplemented feature (e.g. "reload") + 4 - user had insufficient privileges + 5 - program is not installed + 6 - program is not configured + 7 - program is not running + --> + <startCommand>/usr/sbin/rcapache2 start</startCommand> + + <!-- + The reStartCommand tag specifies the command line that will be + invoked to restart the service. The return code from this command + must be as specified in the startCommand tag. + --> + <reStartCommand>/usr/sbin/rcapache2 restart</reStartCommand> + + <!-- + The stopCommand tag specifies the command line that will be + invoked to stop the service. The return code from this command + must be as specified in the startCommand tag. + --> + <stopCommand>/usr/sbin/rcapache2 stop</stopCommand> + + <!-- + The statusCommand specifies the command line that can be run + that will report on the status of the service. The return code + from this command line should be as follows: + 0 - service up and running + 1 - service dead, but /var/run/ pid file exists + 2 - service dead, but /var/lock/ lock file exists + 3 - service not running (unused) + 4 - service status unknown :-( + --> + <statusCommand>/etc/init.d/apache2 status</statusCommand> + + <!-- + The processInformation tag allows the XML Service provider to + identify the processes that belong to the service. This allows + the ServiceProcess associations to be instrumented. + If the process_information tag is not specifed, the will be no + ServiceProcess association for the service. + --> + + <!-- Following is an example of an Apache process --> + <processInformation> + <name>httpd2-prefork</name> + <modulePath>/usr/sbin/httpd2-prefork</modulePath> + <parameter>-f</parameter> + <parameter>/etc/apache2/httpd.conf</parameter> + </processInformation> + + <!-- + The healthDetailCommand tag specifies the command line that will + provide the health data for the service. This command line + should out put the health variables specified in this XML + document as key value pairs. The return code from this + command line should be identical to the command line + specified in the status_command tag. + --> + <healthDetailCommand format="keyvalue"> + /usr/sbin/rcapache2 details + </healthDetailCommand> + + <!-- + The healthyCommand tag is used to specify a command line that + can be invoked to determine if the service is healthy. This could + be considered a boolean operation, but somewhat backward to be in + line with the normal command line idiom. The return + code from this command line should be as follows: + 0 - service is healthy + > 0 - server is NOT healthy. + It should be noted that if a service is not healthy, the + health_detail_command would provide some insight into the + unhealthy condition. + --> + <healthyCommand>/usr/bin/healthy-apache-command</healthyCommand> + + <!-- + The healthData tag is used to define the characteristics of the health + data for the service. It allows you to specify multiple health data + items for the service and their data types. It also allows you to + specify default thresholds for each data item. It is necessary to + provide some of this information to the XML Service provider so + it has some idea about what to do the the health data. + --> + <healthData> + + <dataItem> + <name>Accesses</name> + <description>Total number of times the web server was accessed</description> + <dataType>uint32</dataType> + <defaultThresholds> + <lowerFatal>10</lowerFatal> + <lowerCritical>20</lowerCritical> + <lowerNonCritical>30</lowerNonCritical> + <upperNonCritical>40</upperNonCritical> + <upperCritical>50</upperCritical> + <upperFatal>60</upperFatal> + </defaultThresholds> + </dataItem> + + <dataItem> + <name>kBytes</name> + <description>Total number of kilobytes served</description> + <dataType>uint32</dataType> + <defaultThresholds> + <upperNonCritical>40</upperNonCritical> + <upperCritical>50</upperCritical> + <upperFatal>60</upperFatal> + </defaultThresholds> + </dataItem> + + <dataItem> + <name>Uptime</name> + <description>Total number of minutes the web server has been running</description> + <dataType>uint32</dataType> + <defaultThresholds> + <lowerFatal>10</lowerFatal> + <lowerCritical>20</lowerCritical> + <lowerNonCritical>30</lowerNonCritical> + </defaultThresholds> + </dataItem> + + <dataItem> + <name>ReqPerSec</name> + <description>Number of client requests per second</description> + <dataType>real64</dataType> + </dataItem> + + <dataItem> + <name>BytesPerSec</name> + <description>Number of bytes served per second</description> + <dataType>real64</dataType> + </dataItem> + + <dataItem> + <name>BytesPerReq</name> + <description>Average bytes served per request</description> + <dataType>real64</dataType> + </dataItem> + + <dataItem> + <name>BusyWorkers</name> + <description>Total number of active worker threads</description> + <dataType>uint32</dataType> + </dataItem> + + <dataItem> + <name>IdleWorkers</name> + <description>Total number of inactive worker threads</description> + <dataType>uint32</dataType> + </dataItem> + +<!-- + <dataItem> + <name>ConnectionsPerMinute</name> + <description>Number of client connection received per minute</description> + <dataType>uint32</dataType> + <defaultThresholds> + <lowerFatal>10</lowerFatal> + <lowerCritical>20</lowerCritical> + <lowerNonCritical>30</lowerNonCritical> + <upperNonCritical>40</upperNonCritical> + <upperCritical>50</upperCritical> + <upperFatal>60</upperFatal> + </defaultThresholds> + </dataItem> + + <dataItem> + <name>MemoryUsage</name> + <description>The amount of memory currently being used by the Apache service</description> + <dataType>uint32</dataType> + <defaultThresholds> + <upperCritical>8000</upperCritical> + <upperFatal>12000</upperFatal> + </defaultThresholds> + </dataItem> +--> + + </healthData> + +</serviceDescription> Added: contrib/xml-service-provider/trunk/example-services/apache/Makefile.am =================================================================== --- contrib/xml-service-provider/trunk/example-services/apache/Makefile.am (rev 0) +++ contrib/xml-service-provider/trunk/example-services/apache/Makefile.am 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,5 @@ +EXTRA_DIST = \ + Apache.xml \ + how-to.txt \ + httpdstat.awk + Added: contrib/xml-service-provider/trunk/example-services/apache/how-to.txt =================================================================== --- contrib/xml-service-provider/trunk/example-services/apache/how-to.txt (rev 0) +++ contrib/xml-service-provider/trunk/example-services/apache/how-to.txt 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,37 @@ +1. Configure the Apache Web server with mod_status enabled + - Use the yast-httpd configuration module to enable mod_status + - Or add the appropriate configuration to a mod_status.conf file and + add the .conf file to /etc/apache2/conf.d + - See http://http.apache.org/docs/2.2/mod/mod_status.html + +2. Add a "details" option to the /etc/init.d/apache2 initd script which makes the + appropriate commandline command that produces the health data + + details) + if [ ! -f $pidfile -a -f $pidfile.rpmsave ]; then mv $pidfile.rpmsave $pidfile; fi + #echo -n "Checking for httpd2: " + # we don't use checkproc here since it is confused when we exchange the binaries + if ! [ -f $pidfile ]; then + # not running + rc_failed 3 + elif [ -s $pidfile -a -d /proc/$(<$pidfile) ]; then + /usr/bin/w3m http://localhost/server-status?auto | /usr/bin/awk -f /etc/apache2/httpdstat.awk + # running + : + else + # stale pid file + rc_failed 1 + #rm -f $pidfile + fi + rc_status + ;; + +3. Create an AWK script that converts the health data produced by mod_status to + key/value pairs. See httpdstat.awk + + /usr/bin/w3m http://localhost/server-status?auto | /usr/bin/awk -f /etc/apache2/httpdstat.awk + +4. Create an Apache.xml document that describes all of the health related commands + and data. This is the .xml file that is consumed by the xml-service + provider. See Apache.xml + Added: contrib/xml-service-provider/trunk/example-services/apache/httpdstat.awk =================================================================== --- contrib/xml-service-provider/trunk/example-services/apache/httpdstat.awk (rev 0) +++ contrib/xml-service-provider/trunk/example-services/apache/httpdstat.awk 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,24 @@ + + +#BEGIN { +# printf(" (APACHE2)\n") +#} + +function output_pair (sym_name, sym_value) { + gsub (/:/, "", sym_name) + printf("%s=%s\n", sym_name, sym_value) +} + +$1~/:/ { + if ($1 != "Scoreboard:") { + output_pair($1,$2) + } +} + +$2~/:/ { + output_pair($2,$3) +} + +#END { +# printf(" %s", line) +#} Added: contrib/xml-service-provider/trunk/install-sh =================================================================== --- contrib/xml-service-provider/trunk/install-sh (rev 0) +++ contrib/xml-service-provider/trunk/install-sh 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,294 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} Added: contrib/xml-service-provider/trunk/mof/Makefile.am =================================================================== --- contrib/xml-service-provider/trunk/mof/Makefile.am (rev 0) +++ contrib/xml-service-provider/trunk/mof/Makefile.am 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,2 @@ +EXTRA_DIST = xml-service.mof + Added: contrib/xml-service-provider/trunk/mof/xml-service.mof =================================================================== --- contrib/xml-service-provider/trunk/mof/xml-service.mof (rev 0) +++ contrib/xml-service-provider/trunk/mof/xml-service.mof 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,282 @@ +#pragma locale ("en_US") + +// ================================================================== +// OMC_ServiceFromXML +// ================================================================== +[ Description("The OMC_ServiceFromXML class represents a service " + "that is instrumented by the XML service provider") ] +class OMC_ServiceFromXML : CIM_Service +{ + [ Description("HealthPollingInterval specifies how often the " + "XML Service provider will check the health of the service"), + Units("Seconds") ] + uint64 HealthPollingInterval; + + [ Description("RequiredBadHits specifies the number of times " + "a service must report a unhealthy status at poll time " + "before an indication is generated. If this property is " + "not specified the value of 3 is assumed") ] + uint32 RequiredBadHits = 3; + + [ Description ("The BadHealthActions property holds the actions that must " + "be performed when the HealthState property for this service reaches " + "a degraded(10) or major failure(20) state. The only actions that can " + "be performed are stop and re-start. The property is an array of 2 " + "elements with the elements corresponding to the HealthState " + "property as follows:\n" + "Index 0 = Action to perform for degraded state(HealthState==10)\n" + "Index 1 = Action to perform for major failure state(HealthState==20\n" + "The value for each one of the elements can be as follows:\n" + "0 = Do nothing\n" + "1 = Restart the service\n" + "2 = Stop the service"), + ValueMap { "0", "1", "2" }, + Values{ "No Action", "Restart", "Stop" }, + ArrayType ("Indexed"), + ModelCorrespondence { "CIM_ManagedSystemElement.HealthState" } ] + + uint16 BadHealthActions[]; +}; + +// ================================================================== +// OMC_ServiceFromXMLConfigTool +// ================================================================== +class OMC_ServiceFromXMLConfigTool +{ + [ Key, Propagated("OMC_ServiceFromXML.Name"), + Description("This is the name of the service that configuration " + "tool is used for") ] + string ServiceName; + + [ Key, Description("The TaskName property provides a short name for the " + "task this configuration tool is used for") ] + string TaskName; + + [ Description("The Description property provides discriptive test " + "about this task/configuration tool") ] + string Description; + + [ Required, Description("The Type property specifies what type of " + "access is needed to use the configuration tool") ] + string Type; + + [ Required, Description("The Uri property provides the addressing " + "information needed to access the configuration tool") ] + String Uri; +}; + +// ================================================================== +// OMC_ServiceHealthData +// ================================================================== +[ Description("The OMC_ServiceHealthData class represents a single health " + "data item for a service") ] +class OMC_ServiceHealthData +{ + [ Key, Propagated("OMC_ServiceFromXML.Name"), + Description("This is the name of the service that this health data " + "belongs to.") ] + string ServiceName; + + [ Key, Description("The name of the health data being reported by " + "the service") ] + string DataName; + + [ Description("Free form text that describes this health data") ] + string Description; + + [ Description ("The information in the DataValue property and any " + "of the thresholds is presented as string data. However the " + "appropriate datatype for this information may be something " + "else (e.g. signed 32 bit integer). Knowledge of the appropriate " + "data type may be needed for comparison when processing " + "thresholds."), + ValueMap { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11" }, + Values{ "Unknown", "String", "Unsigned 8 bit", "Signed 8 bit", + "Unsigned 16 bit", "Signed 16 bit", "Unsigned 32 bit", + "Signed 32 bit", "Unsigned 64 bit", "Signed 64 bit", + "Real 32 bit", "Real 64 bit" } ] + uint16 DataType; + + [ Description("The value of the health data specified by DataName " + "for the service") ] + string DataValue; + + [ ArrayType ("Indexed"), + Description("These are the default thresholds that have been set by " + "the service provider. They are used if the actual thresholds " + "have not been set by the administrator. This is an array of " + "six elements with each element representing a certain " + "threshold. The array is ordered as follows:\n" + "0 = Lower Fatal threshold\n" + "1 = Lower Critical threshold\n" + "2 = Lower Non-Critical threshold\n" + "3 = Upper Non-Critical threshold\n" + "4 = Upper Critical threshold\n" + "5 = Upper Fatal threshold\n" + "Each element is the string representation of that threshold " + "value."), + ModelCorrespondence { + "OMC_ServiceHealthData.DataType", + "OMC_ServiceHealthData.DataValue" } ] + string DefaultThresholds[]; + + [ Write, ArrayType ("Indexed"), + Description("These are the thresholds specified by the administrator " + "If they are present, the DefaultThresholds are ignored." + "This is an array of six elements with each element representing " + "a certain threshold. The array is ordered as follows:\n" + "0 = Lower Fatal threshold\n" + "1 = Lower Critical threshold\n" + "2 = Lower Non-Critical threshold\n" + "3 = Upper Non-Critical threshold\n" + "4 = Upper Critical threshold\n" + "5 = Upper Fatal threshold\n" + "Each element is the string representation of that threshold " + "value."), + ModelCorrespondence { + "OMC_ServiceHealthData.DataType", + "OMC_ServiceHealthData.DataValue" } ] + string ActualThresholds[]; + + [ Description("The health state the value of the health item " + "represents"), + ValueMap { "0", "5", "10", "20" }, + Values { "Unknown", "OK", "Degraded/Warning", + "Major failure" } ] + uint16 HealthState; +}; + +// ================================================================== +// OMC_AssociatedConfigTool +// ================================================================== +[ Association, Version ( "0.0.1" ), + Description ("The AssociatedConfigTool association related the " + "service to its configuration tools") ] +class OMC_AssociatedConfigTool +{ + [ Key, Min(1), Max(1), Description("The service the health " + "data belongs to") ] + OMC_ServiceFromXML REF Service; + + [ Key, Description("A configuration tool object for the service") ] + OMC_ServiceFromXMLConfigTool REF ConfigTool; +}; + +// ================================================================== +// OMC_AssociatedHealthData +// ================================================================== +[ Association, Version ( "0.0.1" ), + Description ("The AssociatedHealthData association related the " + "ServiceHealthData objects with the ServiceFromXML " + "objects") ] +class OMC_AssociatedHealthData +{ + [ Key, Min(1), Max(1), Description("The service the health " + "data belongs to") ] + OMC_ServiceFromXML REF Service; + + [ Key, Description("A health data object for the service") ] + OMC_ServiceHealthData REF HealthData; +}; + +// ================================================================== +// OMC_XMLServiceProcess +// ================================================================== +[ Association, Version ( "0.0.1" ), + Description ("The XMLService process relates a service " + "to its processes") ] +class OMC_XMLServiceProcess : CIM_ServiceProcess +{ + [ Override("Service"), Key, Description("The ServiceFromXML " + "that is associated to a process.") ] + OMC_ServiceFromXML REF Service; + + [ Override("Process"), Key, Description("The process that " + "the XMLService is running in.") ] + OMC_UnixProcess REF Process; +}; + +// ================================================================== +// OMC_HostedXMLService +// ================================================================== +[ Association, Version ( "0.0.1" ), + Description ("The HostedXMLService relates the service to " + "the computer system it is running on") ] +class OMC_HostedXMLService : CIM_HostedService +{ + [ Override("Antecedent"), Key, Description("The computer system " + "that hosts the service") ] + OMC_UnitaryComputerSystem REF Antecedent; + + [ Override("Dependent"), Key, Description("The service that is hosted " + "on the computer system.") ] + OMC_ServiceFromXML REF Dependent; +}; + +// ================================================================== +// OMC_XMLServiceServiceDependency +// ================================================================== +[ Association, Description("OMC_XMLServiceServiceDependency " + "represents the relationship of one OMC_ServiceFromXML " + "depending on another") ] +class OMC_XMLServiceServiceDependency : CIM_ServiceServiceDependency +{ + [Override ( "Antecedent" ), Description ( + "The required Service.")] + OMC_ServiceFromXML REF Antecedent; + + [Override ( "Dependent" ), Description ( + "The Service that is dependent on an underlying Service.")] + OMC_ServiceFromXML REF Dependent; +}; + +// ================================================================== +// OMC_XMLServiceHealthAlert +// ================================================================== +[ Indication, + Description("The alert that goes out when health data exceeds the " + "critical or fatal thresholds") ] +class OMC_XMLServiceHealthAlert : CIM_AlertIndication +{ + [ Description("The name of the service the alert is for." + "This is one of the keys to the OMC_ServiceHealthData object") ] + string ServiceName; + + [ Description("The name of the health data item that has exceeded " + "the critical or fatal threshold. This is one of the keys to the " + "OMC_ServiceHealthData object") ] + string HealthDataItemName; + + [ Description("The current value of the item specified in by the " + "HealthDataitemName property") ] + string CurrentValue; + + [ Description ("The information in the CurrentValue property and any " + "of the thresholds is presented as string data. However the " + "appropriate datatype for this information may be something " + "else (e.g. signed 32 bit integer). Knowledge of the appropriate " + "data type may be needed for comparison when processing " + "thresholds."), + ValueMap { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11" }, + Values{ "Unknown", "String", "Unsigned 8 bit", "Signed 8 bit", + "Unsigned 16 bit", "Signed 16 bit", "Unsigned 32 bit", + "Signed 32 bit", "Unsigned 64 bit", "Signed 64 bit", + "Real 32 bit", "Real 64 bit" } ] + uint16 DataType; + + [ Description("The threshold the current value has exceeded"), + ValueMap { "0", "1", "2", "3", "4", "5" }, + Values{ "Lower Fatal", "Lower Critical", "Lower Non-Critical", + "Upper Fatal", "Upper Critical", "Upper Non-Critical" } ] + uint16 ThresholdType; + + [ Description("The value of the threshold that has been exceeded") ] + string ThresholdValue; + + [ Description("The health state the ThresholdValue represents"), + ValueMap { "0", "5", "10", "20" }, + Values { "Unknown", "OK", "Degraded/Warning", + "Major failure" } ] + uint16 HealthState; +}; + Added: contrib/xml-service-provider/trunk/src/Makefile.am =================================================================== --- contrib/xml-service-provider/trunk/src/Makefile.am (rev 0) +++ contrib/xml-service-provider/trunk/src/Makefile.am 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,36 @@ +SUBDIRS = servicexml + +include $(top_srcdir)/Makefile.incl.am + +provider_LTLIBRARIES = \ + libomc_xml_service_resident.la \ + libomc_xml_service_nonresident.la + +INCLUDES = -I$(top_srcdir)/src/servicexml -I$(top_builddir) + +libomc_xml_service_resident_la_SOURCES = \ + XMLServiceProvider.cpp \ + XMLServiceProvider.hpp + +libomc_xml_service_resident_la_LDFLAGS = \ + -lpthread \ + -lopenwbem \ + -lowxml \ + -version-info 1 + +libomc_xml_service_resident_la_LIBADD = \ + $(top_builddir)/src/servicexml/libomc_servicexml.la + +libomc_xml_service_nonresident_la_SOURCES = \ + XMLServiceProviderNonRes.cpp + +libomc_xml_service_nonresident_la_LDFLAGS = \ + -lpthread \ + -lopenwbem \ + -lowxml \ + -lomcbase \ + -version-info 1 + +libomc_xml_service_nonresident_la_LIBADD = \ + $(top_builddir)/src/servicexml/libomc_servicexml.la + Added: contrib/xml-service-provider/trunk/src/XMLServiceProvider.cpp =================================================================== --- contrib/xml-service-provider/trunk/src/XMLServiceProvider.cpp (rev 0) +++ contrib/xml-service-provider/trunk/src/XMLServiceProvider.cpp 2006-11-29 23:25:03 UTC (rev 407) @@ -0,0 +1,1310 @@ +/**************************************************************************** + | Copyright (c) 2006 Novell, Inc. + | All Rights Reserved. + | + | This program is free software; you can redistribute it and/or + | modify it under the terms of version 2 of the GNU General Public License as + | published by the Free Software Foundation. + | + | This program is distributed in the hope that it will be useful, + | but WITHOUT ANY WARRANTY; without even the implied warranty of + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + | GNU General Public License for more details. + | + | You should have received a copy of the GNU General Public License + | along with this program; if not, contact Novell, Inc. + | + | To contact Novell about this file by physical or electronic mail, + | you may find current contact information at www.novell.com + | + |***************************************************************************/ + +// TODO: +// BadHealthActions on Service now. +// Need to honor actions. +// Polling can take place even if there is no subscription (actions). + +#include "XMLServiceProvider.hpp" + +#include <openwbem/OW_CIMValue.hpp> +#include <openwbem/OW_CIMOMHandleIFC.hpp> +#include <openwbem/OW_CIMDataType.hpp> +#include <openwbem/OW_Bool.hpp> +#include <openwbem/OW_Assertion.hpp> +#include <openwbem/OW_Format.hpp> + +#include "omc/CIMUtils.hpp" +#include "omc/ProviderStore.hpp" + +#include <iostream> + +extern "C" +{ +#include <unistd.h> +} + +using namespace OpenWBEM; +using namespace WBEMFlags; +using namespace OMC; +using std::cout; +using std::endl; + +namespace XMLServiceProvider +{ + +namespace +{ + +const char* g_threshNames[] = +{ + "Lower Fatal", + "Lower Critical", + "Lower Non-Critical", + "Upper Non-Critical", + "Upper Critical", + "Upper Fatal" +}; + +////////////////////////////////////////////////////////////////////////////// +time_t +calcPollTime( + UInt32 pollingInterval) +{ + DateTime dtm; + dtm.setToCurrent(); + time_t tm = dtm.get() + time_t(pollingInterval); + return tm; +} + +} // End of unnamed namespace + +////////////////////////////////////////////////////////////////////////////// +ResServiceProvider::ResServiceProvider() + : CppInstanceProviderIFC() + , CppPolledProviderIFC() + , CppIndicationProviderIFC() + , Thread() + , m_env(0) + , m_running(false) + , m_shuttingDown(false) + , m_guard() + , m_qguard() + , m_countGuard() + , m_condition() + , m_threadBarrier(2) + , m_polledServices() + , m_subscriptionCount(0) + , m_pdQueue() + , m_subscribedNamespaces() +{ +} + +////////////////////////////////////////////////////////////////////////////// +ResServiceProvider::~ResServiceProvider() +{ +} + +////////////////////////////////////////////////////////////////////////////// +// TODO: Thread Synchronization? Is is worth it? +void +ResServiceProvider::addSubscribeNamespace(const String ns) +{ + for (StringArray::size_type i = 0; i < m_subscribedNamespaces.size(); i++) + { + if (ns == m_subscribedNamespaces[i]) + return; + } + m_subscribedNamespaces.append(ns); +} + +////////////////////////////////////////////////////////////////////////////// +void +ResServiceProvider::initialize( + const ProviderEnvironmentIFCRef& env) +{ + LoggerRef lgr = logger(env); + OW_LOG_DEBUG(lgr, PREF"initialize called..."); +} + +////////////////////////////////////////////////////////////////////////////// +void +ResServiceProvider::shuttingDown( + const ProviderEnvironmentIFCRef& env) +{ + LoggerRef lgr = logger(env); + OW_LOG_DEBUG(lgr, PREF"shuttingDown called..."); + if (!m_running) + { + OW_LOG_DEBUG(lgr, PREF"shuttingDown called, but not currently " + "running"); + return; + } + + m_shuttingDown = true; + m_condition.notifyAll(); + + OW_LOG_DEBUG(lgr, PREF"shuttingDown: waiting for thread barrier"); + m_threadBarrier.wait(); + OW_LOG_DEBUG(lgr, PREF"shuttingDown: finished. Returning"); +} + +////////////////////////////////////////////////////////////////////////////// +Int32 +ResServiceProvider::run() +{ + LoggerRef lgr = logger(m_env); + OW_LOG_DEBUG(lgr, PREF"run called..."); + m_running = true; + OW_LOG_DEBUG(lgr, PREF"run: waiting on thread barrier"); + m_threadBarrier.wait(); + OW_LOG_DEBUG(lgr, PREF"run: -done- waiting on thread barrier"); + + OW_LOG_DEBUG(lgr, PREF"run: creating thread pool"); + String poolName = COMPONENT"threadpool"; + ThreadPoolRef threadPool = ThreadPoolRef(new ThreadPool( + ThreadPool::DYNAMIC_SIZE, 10, 100, lgr, poolName)); + + NonRecursiveMutexLock localLock(m_guard); + + // Fill polling queue with polling data gathered from the auxiliary + // storage here. + m_pdQueue.clear(); + try + { + ServiceFromXMLRefArray svcs = ServiceFromXML::getServices(m_env); + OW_LOG_DEBUG(lgr, + Format(PREF"run: Got list of services to check. List size: %1", + svcs.size())); + + for (ServiceFromXMLRefArray::size_type i = 0; i < svcs.size(); i++) + { + // Only poll service if polling interval was specified + // and there are actual thresholds. + if (svcs[i]->getPollingInterval() > 0 + && svcs[i]->hasActualThresholds()) + { + OW_LOG_DEBUG(lgr, + Format(PREF"Service %1... [truncated message content] |