• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Automated self-testing and health check of CQ and Sling instances
 

Automated self-testing and health check of CQ and Sling instances

on

  • 1,487 views

Slides of my CQCon 2013 "Automated self-testing and health check of CQ instances", see http://www.cqcon.eu/2013/en/speakers/bertrand-delacretaz.html and ...

Slides of my CQCon 2013 "Automated self-testing and health check of CQ instances", see http://www.cqcon.eu/2013/en/speakers/bertrand-delacretaz.html and http://sling.apache.org/documentation/bundles/sling-health-check-tool.html

Statistics

Views

Total Views
1,487
Views on SlideShare
1,483
Embed Views
4

Actions

Likes
4
Downloads
26
Comments
0

1 Embed 4

https://twitter.com 4

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Automated self-testing and health check of CQ and Sling instances Automated self-testing and health check of CQ and Sling instances Presentation Transcript

    • CQ5HealthCheckAutomated self-testingand health checkof live CQ instancesBertrand DelacrétazSenior R&D Developer, Adobe Basel@bdelacretaz, grep.codeconsult.chCQCon, Basel, June 2013slides revision 2013-06-19
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe Baselpicture: anitapeppers on morguefile.comThemoreconfigurable,themorebreakable....letstestitlive!Agile softwareneedsTESTING
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselApache Sling Health CheckWebconsole pluginRules configured in contentTagged rulesWebconsole and servletsRuleBuilder OSGi servicesApacheSlingmodule,runsinCQ5.5andlaterMuppet
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselJSON output selectors map to tagsno news (log) is good news!Rule uses a Logger to complainrule 1rule 2
    • rules
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselRule defined in content$ curl -u admin:adminhttp://localhost:4502/apps/hc/demo/inactive-bundles.tidy.json{"sling:resourceType": "sling/healthcheck/rules","namespace": "osgi","ruleName": "inactive.bundles.count","expression": "<= 3","tags": ["bundles","osgi","sling"],"jcr:primaryType": "nt:unstructured"}Execute the osgi:inactive.bundles.count ruleand verify that its output is <= 3The rules engine executes a tree of such definitions, optionally taking tags into account.
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselHTTP rule execution$ curl -u admin:adminhttp://localhost:4502/apps/hc/demo/inactive-bundles.healthcheck.json{"results": [{"rule": "Rule: InactiveBundlesCount <= 3","info": [{"sling.resource.path": "/apps/hc/demo/inactive-bundles"}],"tags": ["sling","bundles","osgi"]}]}Rule path with .healthcheck selectorWorks with single rules or treesno news (log) is good news!
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselRule scripts$ curl -u admin:adminhttp://localhost:4502/apps/hc/demo/script-that-passes.esp# A rule script must output only TEST_PASSED,# comments like this one and white space.# Anything else is considered failure#(as with the Sling testing tools)TEST_PASSEDCurrently executable only from asling/healthcheck/rules container resource.#theskyisthelimit
    • outof thebox
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselOut of the box rulesas of revision 1490454JMXbeans attributesjmxbeans:org.apache.sling:type=engine,service=RequestProcessorRequestsCount < 20JUnittestsjunit:org.apache.sling.hc.demo.tests.ResourcesExistTest(can use @TestReference for services)OSGibundlestateosgi:bundle.stateorg.apache.sling.startupfilter.disabler= activeOSGiinactivebundlesosgi:inactive.bundles.count < 3Sling defaultlogins failsling:loginfailsadmin#adminpicture:mconnorsonmorguefile.comSlingscripts/apps/hc/demo/somescript.espBYOR!
    • extensibili t y
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselRule evaluates a SystemAttribute
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselRuleBuilder service builds Rulescheck namespacemap ruleName toSystemAttributebuild Ruletest:constant:5 = 5namespace:ruleName:qualifier expr
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselDefaultEvaluator expressionscan use custom Evaluator as well“Some string”< 5> 5<= 5>= 5between 5 and 12public interface Evaluator {void evaluate(SystemAttribute a,String expression,Logger logger);}
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselExtensibility summaryImplement a SystemAttributegetValue(Logger)Register a RuleBuilder servicecheck namesbuild SystemAttribute + RuleThat’s it.(optionally supply custom Evaluator)
    • similarideas
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselJoerg Hoh’s cq5-healthcheckhttps://github.com/joerghoh/cq5-healthcheckPID = de.joerghoh.cq5.healthcheck.MBeanStatusProvider.b9cb0c91-972bmbean.name = com.adobe.granite.replication:type=agent,id="publish"mbean.property = QueueNumEntries.warn.>.100mbean.providerHint = Warn Queue lengthMBean attribute valueranges or customStatusProvider servicesCQ:Page for statusBased on OSGi configs:
    • CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselDavide Giannella’s sanitycheckAdobe Internal github for now: dgiannel/sanitycheckServlets as sanitycheck services.CQ page componentsfor options, forms.Checks remote CQinstances via HTTP.CQ pages to assemblesanity check pages.
    • future
    • CQ5HealthCheckFuture?Implement CQ security checklist rulesExecute rules via JMX?Scheduling of rules execution + reportingScheduling and time-based range checks, samplingperiods (thx Radu Cotescu)Whatareyourusecases?Execute rules tagged “startup” at startupand report or lock instance if WARN.http://sling.apache.org/documentation/bundles/sling-health-check-tool.htmlI’m @bdelacretaz - thanks for attending!<YOUR IDEA HERE> or on the Apache Sling mailing lists