Automated self-testing and health check of live Sling instances

2,135 views
2,024 views

Published on

Slides of my talk at adaptTop 2013, "Automated self-testing and health check of live Sling instances". The use cases are similar to my previous presentation at CQCon, but the tool has been almost completely rewritten in the meantime. See http://sling.apache.org/documentation/bundles/sling-health-check-tool.html for more info on the Sling health check tools.

Published in: Technology, Economy & Finance
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,135
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
35
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Automated self-testing and health check of live Sling instances

  1. 1. Automatedself-testingandhealthcheck ofliveSlinginstances BertrandDelacrétaz Slingcommitter,ASFMemberand(current)Director SeniorDeveloper,AdobeCQR&Dteam,Basel @bdelacretaz-grep.codeconsult.ch adaptTo()Berlin,September2013 slidesrevision2013-09-24
  2. 2. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz How can you trust your current (fragile?) combination of OSGi bundles and configs? It needs live TESTING. 2 picture: anitapeppers on morguefile.com
  3. 3. whatdowemeanby HealthChecks?
  4. 4. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz HealthCheck APIs 4 public interface HealthCheck { Result execute(); } public class Result { public boolean isOk() ... public Status getStatus() ... public Iterator<ResultLog.Entry> iterator() ... } HealthCheck OSGi services Serviceprops: name,MBean,tags
  5. 5. Webconsole,JMX
  6. 6. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz Webconsole plugin /system/console/healthcheck 6
  7. 7. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz Health Check MBeans 7 Serviceprops name,MBean,tags
  8. 8. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz Health Checks as JMX processors 8 MBean MBean MBean HC HC HC using expressions like jmx.attribute('java.lang:type=ClassLoading', 'LoadedClassCount') > 10 && jmx.attribute('java.lang:type=Runtime', 'ManagementSpecVersion') > 1
  9. 9. Usecases
  10. 10. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz Use cases 10 System status Configuration Self-testPerformance Allbundlesup? Initialcontentready? Diskspaceok? Externalservicesok? Loadwithinbounds?(forjobs) Requestspersecondok? Requestdurationok? Freememoryok? Replicationqueuesok? Securitychecklistok? Defaultaccountsdisabled? Democontentremoved? Startupsmoketests? Keephistoryofresults?
  11. 11. whatdoyouget Outofthebox?
  12. 12. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz Out of the box - core 12 JmxAttributeHealthCheck ScriptableHealthCheck CompositeHealthCheck Single JMX attributes Script(let)s in any language using BindingValuesProviders Run other Health Checks based on their tags
  13. 13. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz Out of the box - support bundle 13 SlingRequestStatusHC DefaultLoginsHealthCheck Is my resource there? Including its scripts? admin:admin -> fail? current HC bundles: org.apache.sling.hc.core org.apache.sling.hc.support org.apache.sling.hc.webconsole org.apache.sling.hc.jmx org.apache.sling.hc.samples
  14. 14. howdoyouwrite YourownHealthChecks?
  15. 15. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz Custom Health Checks 15 @Component(...policy=ConfigurationPolicy.REQUIRE, metatype=true) @Property(name=HealthCheck.NAME), @Property(name=HealthCheck.TAGS,unbounded=PropertyUnbounded.ARRAY), @Property(name=HealthCheck.MBEAN_NAME) @Service(value=HealthCheck.class) public class MyHealthCheck { public Result execute() { FormattingResultLog f = new FormattingResultLog(); ... if(badThings) f.warn(“Something happened with {}”, foo); return new Result(f); } } Execute “quickly”, cache...
  16. 16. Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz That’s it - have fun! 16 JmxAttributeHealthCheck ScriptableHealthCheck CompositeHealthCheck SlingRequestStatusHC DefaultLoginsHealthCheck @Service(value=HealthCheck.class) public class MyHealthCheck { ....generate a Result quickly } Docs at sling.apache.org : bundles : health check. Discuss on the Sling dev list. I’m @bdelacretaz - thanks! JMX processors Webconsole
  17. 17. APACHE SLING & FRIENDS TECH MEETUP BERLIN, 23-25 SEPTEMBER 2013

×