Hi all,

What I've been working towards this week is the idea that we can use our
discovery information to automatically start monitoring some kinds of
things on the basis of our discovery data.  I put this on the main list
because it's something everyone needs to be aware of -- and to comment
on if you're so inclined.

Almost all the code for doing this is written and has been (minimally)
tested.

The next step is to be able to have the code read in specifications of
how to monitor various kinds of services.

It's a bit odd, since we have figure out whether a particular service is
one of the ones we know how to monitor, and we also have to be able to
tell the monitoring software what it needs to know in order to monitor
it.  But we don't have to monitor it, we just have to know how to tell
the monitoring agents what they need to know.

The example below is for an OCF resource agent (not yet written) that
monitors the neo4j database.  In order to monitor it properly this agent
would need to know what port this particular neo4j database is listening
on.  In this config file, I also pick up the home directory for this
neo4j database (although I don't think the monitoring agent would need
to know it.

Below is my current thinking of what this ought to look like.

-------------------------------------------------------------------------------------------------------------
#
#    Configuration for automatically monitoring the Neo4j graph database
with an OCF
#    resource agent called "neo4j" provided by the "assimilation" provider.
#
#    Except for the comments, the syntax is pure JSON.  Note that this
means that you have to
#    double escape literal '.' characters in regular expressions
#
#    And don't forget that the final element in a JSON list or object is
not followed by a comma
#
#
#    How this works, is you need to tell us what we need to look for in
the discovery data
#    to help us realize that the service we're looking at is the service
we know how to monitor.
#
#    We also have to know how to pick up parameters to give the
monitoring code so
#    it knows how to monitor the service.
#
#    In this case, we know it's our service IF
#        The pathname of the binary ends in "/java"
#    and    The last argument to this service is
"org.neo4j.server.Bootstrapper"
#
#    To properly monitor this service we need to know what port it is
listening on
#    and (somewhat gratuitiously) what it's home directory is.
#
#    The port it's listening on is supplied to the monitoring agent as
the parameter PORT
#    and the neo4j home directory is supplied to it as the parameter HOME.
#
#    The 'expression-to-evaluate' below is how we figure out the values
of these parameters
#    or expressions to match against regular expressions
#
#    These expressions are evaluated in the context of the selected
graph nodes:
#        - the graph node for the service we've discovered
#        - the graph node for the host that this service is running on
#    If either of these two has the information we need to know, and our
expression language
#    is powerful enough to pick it out, then we're golden!
#
#
{
    "class":    "ocf",
    "type":        "neo4j",
    "provider":    "assimilation",
    "classconfig": [
#        OCF parameter    expression-to-evaluate        regular expression
        [null,        "pathname",             ".*/java"],
        [null,        "arglist[-1]",           
"org\\.neo4j\\.server\\.Bootstrapper$"],
        ["PORT",    "serviceport",            "[0-9]+$"],
        ["NEOHOME",    "@argequals(-Dneo4j.home)",    "/.*"]
#        The argequals function will look for an argument that looks like
#        "-DNeo4j.home=something" and then returns the 'something' for
its value.
#        In this case, we expect to see a value something like /var/lib/neo4
#        for the value that goes with that string.
    ]
}
-------------------------------------------------------------------------------------------------------------------------------
To really understand this, you also need to know what kind of discovery
information it's looking at.  The service node has an attribute called
"pathname" that is the full pathname to the binary that's running, and
an attribute called arglist which is an array of strings containing the
arguments that were given to the service when it started.  For a Java
program, it's typically a very long array of strings -- about 2800
characters for neo4j.

For neo4j, the *pathname* is "/usr/bin/java", and the *arglist* is as
shown below (with each argument starting a new line):

/usr/bin/java
-cp
/var/lib/neo4j/lib/concurrentlinkedhashmap-lru-1.3.1.jar:/var/lib/neo4j/lib/geronimo-jta_1.1_spec-1.1.1.jar:/var/lib/neo4j/lib/lucene-core-3.6.2.jar:/var/lib/neo4j/lib/neo4j-cypher-2.0.0-M04.jar:/var/lib/neo4j/lib/neo4j-graph-algo-2.0.0-M04.jar:/var/lib/neo4j/lib/neo4j-graph-matching-2.0.0-M04.jar:/var/lib/neo4j/lib/neo4j-jmx-2.0.0-M04.jar:/var/lib/neo4j/lib/neo4j-kernel-2.0.0-M04.jar:/var/lib/neo4j/lib/neo4j-lucene-index-2.0.0-M04.jar:/var/lib/neo4j/lib/neo4j-shell-2.0.0-M04.jar:/var/lib/neo4j/lib/neo4j-udc-2.0.0-M04.jar:/var/lib/neo4j/lib/org.apache.servicemix.bundles.jline-0.9.94_1.jar:/var/lib/neo4j/lib/scala-library-2.10.1.jar:/var/lib/neo4j/lib/server-api-2.0.0-M04.jar:/var/lib/neo4j/system/lib/asm-3.1.jar:/var/lib/neo4j/system/lib/bcprov-jdk16-140.jar:/var/lib/neo4j/system/lib/commons-beanutils-1.8.0.jar:/var/lib/neo4j/system/lib/commons-beanutils-core-1.8.0.jar:/var/lib/neo4j/system/lib/commons-collections-3.2.1.jar:/var/lib/neo4j/system/lib/commons-configuration-1.6.jar:/var/lib/neo4j/system/lib/commons-digester-1.8.1.jar:/var/lib/neo4j/system/lib/commons-io-1.4.jar:/var/lib/neo4j/system/lib/commons-lang-2.4.jar:/var/lib/neo4j/system/lib/commons-logging-1.1.1.jar:/var/lib/neo4j/system/lib/jackson-core-asl-1.9.7.jar:/var/lib/neo4j/system/lib/jackson-jaxrs-1.9.7.jar:/var/lib/neo4j/system/lib/jackson-mapper-asl-1.9.7.jar:/var/lib/neo4j/system/lib/janino-2.5.10.jar:/var/lib/neo4j/system/lib/jcl-over-slf4j-1.6.1.jar:/var/lib/neo4j/system/lib/jersey-core-1.9.jar:/var/lib/neo4j/system/lib/jersey-multipart-1.9.jar:/var/lib/neo4j/system/lib/jersey-server-1.9.jar:/var/lib/neo4j/system/lib/jetty-6.1.25.jar:/var/lib/neo4j/system/lib/jetty-util-6.1.25.jar:/var/lib/neo4j/system/lib/jsr311-api-1.1.2.r612.jar:/var/lib/neo4j/system/lib/logback-access-0.9.30.jar:/var/lib/neo4j/system/lib/logback-classic-0.9.30.jar:/var/lib/neo4j/system/lib/logback-core-0.9.30.jar:/var/lib/neo4j/system/lib/mimepull-1.6.jar:/var/lib/neo4j/system/lib/neo4j-server-2.0.0-M04.jar:/var/lib/neo4j/system/lib/neo4j-server-2.0.0-M04-static-web.jar:/var/lib/neo4j/system/lib/parboiled-core-1.1.5.jar:/var/lib/neo4j/system/lib/parboiled-scala_2.10-1.1.5.jar:/var/lib/neo4j/system/lib/rhino-1.7R3.jar:/var/lib/neo4j/system/lib/rrd4j-2.0.7.jar:/var/lib/neo4j/system/lib/servlet-api-2.5-20081211.jar:/var/lib/neo4j/system/lib/slf4j-api-1.6.2.jar:/var/lib/neo4j/conf
-server
-XX:+DisableExplicitGC
-Dorg.neo4j.server.properties=conf/neo4j-server.properties
-Djava.util.logging.config.file=conf/logging.properties
-Dlog4j.configuration=file:conf/log4j.properties
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
*-Dneo4j.home=/var/lib/neo4j*
-Dneo4j.instance=/var/lib/neo4j
-Dfile.encoding=UTF-8
*o**rg.neo4j.server.Bootstrapper*




-- 
    Alan Robertson <[email protected]> - @OSSAlanR

"Openness is the foundation and preservative of friendship...  Let me claim 
from you at all times your undisguised opinions." - William Wilberforce

_______________________________________________
Assimilation mailing list - Discovery-Driven Monitoring
[email protected]
http://lists.community.tummy.com/cgi-bin/mailman/listinfo/assimilation
http://assimmon.org/

Reply via email to