[ 
https://issues.apache.org/jira/browse/SLING-2983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13722459#comment-13722459
 ] 

Bertrand Delacretaz commented on SLING-2983:
--------------------------------------------

Added a JMX binding in revision 1508067, allows for writing rules that evaluate 
combinations of JMX attributes, such as:

{
  "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"
}
                
> Scripted expressions for Health Check rules
> -------------------------------------------
>
>                 Key: SLING-2983
>                 URL: https://issues.apache.org/jira/browse/SLING-2983
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>
> I have implemented scripted expressions for Health Check rules, that can use 
> any Sling scripting language and must return true for the Rule to be 
> successful.
> Here's two examples from [1]:
> scripted-ecma.json:
> {
>   "sling:resourceType" : "sling/healthcheck/rules",
>   "namespace": "script",
>   "ruleName": "Test javascript (ecma) rule",
>   "qualifier": "ecma",
>   "expression": "Math.round(2.6) == 3",
>   "tags" : ["script","javascript"],
>   "jcr:primaryType": "nt:unstructured"
> }
> scripted-groovy.json:
> {
>   "sling:resourceType" : "sling/healthcheck/rules",
>   "namespace": "script",
>   "ruleName": "Test Groovy rule",
>   "qualifier": "groovy",
>   "expression": "someList = [1776, -1, 33, 99, 0, 928734928763] ; someList[2] 
> == 33",
>   "tags" : ["script","groovy"],
>   "jcr:primaryType": "nt:unstructured"
> }
> [1]  
> https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/sling-demo/src/main/resources/SLING-CONTENT/apps/hc/demo

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to