Author: bdelacretaz Date: Mon Jul 29 13:59:28 2013 New Revision: 1508072 URL: http://svn.apache.org/r1508072 Log: Document scripted JMX rules
Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Modified: sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext?rev=1508072&r1=1508071&r2=1508072&view=diff ============================================================================== --- sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/sling-health-check-tool.mdtext Mon Jul 29 13:59:28 2013 @@ -39,7 +39,28 @@ The screenshot below shows an example, a ![](sling-hc-plugin.jpg) -## JMX access to Health Check Rules results +## JMX interfaces + +### Accessing and combining JMX attributes in scripted rules +Although the basic _jmxbeans_ rules give access to single JMX attribute values in rules, a more powerful way to access +JMX attributes is to use scripted rules, where mini-scripts can be written to combine and check multiple values. + +The rule definition shown below, for example, checks two JMX attributes. Such scripted rules can be written in any scripting language +that Sling supports, which allows for creating rules that check JMX attributes against other values. + + { + "sling:resourceType" : "sling/healthcheck/rules", + "namespace": "script", + "ruleName": "Example javascript expression that combines two JMX attributes", + "qualifier": "ecma", + "expression": + 'jmx.attribute("java.lang:type=ClassLoading", "LoadedClassCount") > 100 + && jmx.attribute("osgi.core:type=framework,version=1.5","FrameworkStartLevel") > 1', + "tags" : ["script","javascript", "jmx" ], + "jcr:primaryType": "nt:unstructured" + } + +### JMX access to Health Check Rules results Creating _org.apache.sling.hc.sling.impl.RulesMBeans_ OSGi configurations causes the results of health check rules to be made available via JMX MBeans in the _org.apache.sling.healthcheck_ JMX tree. @@ -60,5 +81,4 @@ data is read-only. ## Known issues See [SLING-2822](https://issues.apache.org/jira/browse/SLING-2822) for details. - [1]: http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo \ No newline at end of file