SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
Sling  health  checks      -­‐      Bertrand  Delacretaz
Tamingyour

AEMinstances
withthe

ApacheSling
HealthCheckTools
BertrandDelacrétaz

PrincipalScientist,AdobeCQ/AEMR&Dteam,Basel
ApacheSlingcommitter,ASFMemberand(current)Director

@bdelacretaz-grep.codeconsult.ch
AEMHubLondon,April2014
slidesrevision2014-04–09,atslideshare.net/bdelacretaz
Sling  health  checks      -­‐      Bertrand  Delacretaz
picture: anitapeppers on
morguefile.com
How  can  you  trust  your  
current  (fragile?)  
combina?on  of  OSGi  
bundles  and  configs?  
!
It  needs  live  
TESTING.  
Sling  health  checks      -­‐      Bertrand  Delacretaz
Test  code  in  my  produc?on  instance?
picture: melschmitz on morguefile.com
Sling  health  checks      -­‐      Bertrand  Delacretaz
whatdowemeanby

Health
Checks?
Sling  health  checks      -­‐      Bertrand  Delacretaz
Health  Checks?
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
Sling  health  checks      -­‐      Bertrand  Delacretaz
Webconsoleand
JMX
Sling  health  checks      -­‐      Bertrand  Delacretaz
Webconsole  /system/console/healthcheck
Sling  health  checks      -­‐      Bertrand  Delacretaz
Health  Check  MBeans  (auto-­‐created)
Serviceprops

:
name,MBean,tags
Sling  health  checks      -­‐      Bertrand  Delacretaz
Health  Checks  as  JMX  Processors
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
Sling  health  checks      -­‐      Bertrand  Delacretaz
JMX  ResourceProvider
curl
http://localhost:8080/system/sling/monitoring/mbeans/...queriesStatus.tidy.2.json
{
"mbean:objectName": 

“org.apache.sling.healthcheck:name=qs,type=HealthCheck",
"sling:resourceType": "sling:mbean",
"hc.name": "Query Performance",
"mbean:description": "Health check",
"status": "OK",
"log": …
Sling  health  checks      -­‐      Bertrand  Delacretaz
herecomesthe

big(?)






demo!
(webconsole,JMX,configuration)
Sling  health  checks      -­‐      Bertrand  Delacretaz
typicalUseCases
Sling  health  checks      -­‐      Bertrand  Delacretaz
Typical  Use  Cases
System status
Allbundlesup?
Initialcontentready?
Diskspaceok?
Externalservicesok?
Loadwithinbounds?(forjobs)
Performance
Requestspersecondok?
Requestdurationok?
Freememoryok?
Replicationqueuesok?
Configuration
Securitychecklistok?
Defaultaccountsdisabled?
Democontentremoved?
Self-test
Startupsmoketests?
Keephistoryofresults?
ReporttoHTTPfront-end
http://bit.ly/Qjxh93
TalktoJustinEdelson!
Sling  health  checks      -­‐      Bertrand  Delacretaz
Sling  devops  experiments
https://github.com/bdelacretaz/
sling-devops-vol1
Health checks tell the
cluster controller when a
Sling instance is ready to
be injected in the cluster.
Sling  health  checks      -­‐      Bertrand  Delacretaz
whatdoyouget

Outofthebox?
Sling  health  checks      -­‐      Bertrand  Delacretaz
Out  of  the  Box  -­‐  core
JmxAttributeHealthCheck
ScriptableHealthCheck
CompositeHealthCheck
Single JMX attributes
Script(let)s in any language

using BindingValuesProviders

Run other Health Checks
based on their tags
Sling  health  checks      -­‐      Bertrand  Delacretaz
Out  of  the  box  -­‐  support  bundle
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.samples
JUnitHealthCheck
And also:
From the junit.healthcheck bundle
Sling  health  checks      -­‐      Bertrand  Delacretaz
howdoyouwrite

YourownHealth
Checks?
Sling  health  checks      -­‐      Bertrand  Delacretaz
BYOHC  -­‐  Bring  Your  Own  HCs  !
@Component(...policy=ConfigurationPolicy.REQUIRE, metatype=true)
@Service(value=HealthCheck.class)
!
@Property(name=HealthCheck.NAME),
@Property(name=HealthCheck.TAGS,unbounded=PropertyUnbounded.ARRAY),
@Property(name=HealthCheck.MBEAN_NAME)
!
public class MyHealthCheck {
public Result execute() {
FormattingResultLog f = new FormattingResultLog();
...
if(badThings) f.warn(“Something happened with {}”, foo);
return new Result(f);
}
}
Sling  health  checks      -­‐      Bertrand  Delacretaz
HealthChecksExecutor
Sling  health  checks      -­‐      Bertrand  Delacretaz
Health  Check  Executor  Service
public interface HealthCheckExecutor {
!
List<HealthCheckExecutionResult>

execute(String... tags);
!
}
ExecutesHCsselectedbytags,withcaching.
Resultincludesexecutionmetadata,timeoutinfoetc.
Sling  health  checks      -­‐      Bertrand  Delacretaz
docs at sling.apache.org : bundles : health check.
discuss on the Apache Sling dev list.
I’m @bdelacretaz - thanks!
JMX processors
Webconsole
JmxAttributeHealthCheck
ScriptableHealthCheck
CompositeHealthCheck
SlingRequestStatusHC
DefaultLoginsHealthCheck
JUnitHealthCheck
That’s  it!  Have  fun.
@Service(HealthCheck.class)

public class MyHealthCheck {
....generate a Result here…
}

Contenu connexe

Similaire à Sling health Checks by Bertrand Delacretaz

Similaire à Sling health Checks by Bertrand Delacretaz (20)

Chaos is a ladder !
Chaos is a ladder !Chaos is a ladder !
Chaos is a ladder !
 
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
 
Management of modes and states with Capella
Management of modes and states with CapellaManagement of modes and states with Capella
Management of modes and states with Capella
 
Dave Karow, Split. Powering Progressive Delivery With Data
Dave Karow, Split. Powering Progressive Delivery With DataDave Karow, Split. Powering Progressive Delivery With Data
Dave Karow, Split. Powering Progressive Delivery With Data
 
Apache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationApache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentation
 
Code Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application MigrationsCode Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application Migrations
 
Agile Days Twin Cities 2011
Agile Days Twin Cities 2011Agile Days Twin Cities 2011
Agile Days Twin Cities 2011
 
testing for people who hate testing
testing for people who hate testingtesting for people who hate testing
testing for people who hate testing
 
JDD 2016 - Bartosz Majsak - Meet The Assertable Chaos Monkeys
JDD 2016 - Bartosz Majsak - Meet The Assertable Chaos Monkeys JDD 2016 - Bartosz Majsak - Meet The Assertable Chaos Monkeys
JDD 2016 - Bartosz Majsak - Meet The Assertable Chaos Monkeys
 
AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
AdaCore Paris Tech Day 2016: Eric Perlade - Verification SolutionsAdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
 
DevSecOps and the CI/CD Pipeline
 DevSecOps and the CI/CD Pipeline DevSecOps and the CI/CD Pipeline
DevSecOps and the CI/CD Pipeline
 
Introduction to Arquillian framework
Introduction to Arquillian  frameworkIntroduction to Arquillian  framework
Introduction to Arquillian framework
 
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOpsPVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
 
Ms arch dev-ops
Ms arch dev-opsMs arch dev-ops
Ms arch dev-ops
 
Buying a Ferrari for your teenager? You may want to think twice
Buying a Ferrari for your teenager? You may want to think twiceBuying a Ferrari for your teenager? You may want to think twice
Buying a Ferrari for your teenager? You may want to think twice
 
Hyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkitHyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkit
 
Testing Django Applications
Testing Django ApplicationsTesting Django Applications
Testing Django Applications
 
Pragmatic Pipeline Security
Pragmatic Pipeline SecurityPragmatic Pipeline Security
Pragmatic Pipeline Security
 
PyParis2018 - Python tooling for continuous deployment
PyParis2018 - Python tooling for continuous deploymentPyParis2018 - Python tooling for continuous deployment
PyParis2018 - Python tooling for continuous deployment
 
Integration Testing on Steroids: Run Your Tests on the Real Things
Integration Testing on Steroids: Run Your Tests on the Real ThingsIntegration Testing on Steroids: Run Your Tests on the Real Things
Integration Testing on Steroids: Run Your Tests on the Real Things
 

Plus de AEM HUB

Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...
Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...
Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...
AEM HUB
 

Plus de AEM HUB (20)

Microservices for AEM by Maciej Majchrzak
Microservices for AEM by Maciej MajchrzakMicroservices for AEM by Maciej Majchrzak
Microservices for AEM by Maciej Majchrzak
 
When dispatcher caching is not enough by Jakub Wądołowski
When dispatcher caching is not enough by Jakub WądołowskiWhen dispatcher caching is not enough by Jakub Wądołowski
When dispatcher caching is not enough by Jakub Wądołowski
 
Sling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak KhetawatSling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak Khetawat
 
PhoneGap Enterprise Viewer by Anthony Rumsey
PhoneGap Enterprise Viewer by Anthony RumseyPhoneGap Enterprise Viewer by Anthony Rumsey
PhoneGap Enterprise Viewer by Anthony Rumsey
 
Integrating Apache Wookie with AEM by Rima Mittal and Ankit Gubrani
Integrating Apache Wookie with AEM by Rima Mittal and Ankit GubraniIntegrating Apache Wookie with AEM by Rima Mittal and Ankit Gubrani
Integrating Apache Wookie with AEM by Rima Mittal and Ankit Gubrani
 
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonMastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin Edelson
 
Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...
 
Touching the AEM component dialog by Mateusz Chromiński
Touching the AEM component dialog by Mateusz ChromińskiTouching the AEM component dialog by Mateusz Chromiński
Touching the AEM component dialog by Mateusz Chromiński
 
How to build a Social Intranet with Adobe Sites and 3rd Party products ... us...
How to build a Social Intranet with Adobe Sites and 3rd Party products ... us...How to build a Social Intranet with Adobe Sites and 3rd Party products ... us...
How to build a Social Intranet with Adobe Sites and 3rd Party products ... us...
 
How do you build flexible platforms that focuses on business needs? by Fahim...
How do you build flexible platforms that focuses on business needs?  by Fahim...How do you build flexible platforms that focuses on business needs?  by Fahim...
How do you build flexible platforms that focuses on business needs? by Fahim...
 
AEM Apps Enhanced: In-app Messaging and Beacons by John Fait
AEM Apps Enhanced: In-app Messaging and Beacons by John FaitAEM Apps Enhanced: In-app Messaging and Beacons by John Fait
AEM Apps Enhanced: In-app Messaging and Beacons by John Fait
 
Effectively Scale and Operate AEM with MongoDB by Norberto Leite
Effectively Scale and Operate AEM with MongoDB by Norberto LeiteEffectively Scale and Operate AEM with MongoDB by Norberto Leite
Effectively Scale and Operate AEM with MongoDB by Norberto Leite
 
Adobe Managed Services: Complicated Cloud Deployments by Adam Pazik, Mike Til...
Adobe Managed Services: Complicated Cloud Deployments by Adam Pazik, Mike Til...Adobe Managed Services: Complicated Cloud Deployments by Adam Pazik, Mike Til...
Adobe Managed Services: Complicated Cloud Deployments by Adam Pazik, Mike Til...
 
Adobe Marketing Cloud Integrations: Myth or Reality? by Holger Marsen
Adobe Marketing Cloud Integrations: Myth or Reality? by Holger MarsenAdobe Marketing Cloud Integrations: Myth or Reality? by Holger Marsen
Adobe Marketing Cloud Integrations: Myth or Reality? by Holger Marsen
 
Responsive Websites and Grid-Based Layouts by Gabriel Walt
Responsive Websites and Grid-Based Layouts by Gabriel Walt Responsive Websites and Grid-Based Layouts by Gabriel Walt
Responsive Websites and Grid-Based Layouts by Gabriel Walt
 
When Sightly Meets Slice by Tomasz Niedźwiedź
When Sightly Meets Slice by Tomasz NiedźwiedźWhen Sightly Meets Slice by Tomasz Niedźwiedź
When Sightly Meets Slice by Tomasz Niedźwiedź
 
Creativity without comprise by Cleve Gibbon
Creativity without comprise by Cleve Gibbon Creativity without comprise by Cleve Gibbon
Creativity without comprise by Cleve Gibbon
 
REST in AEM by Roy Fielding
REST in AEM by Roy FieldingREST in AEM by Roy Fielding
REST in AEM by Roy Fielding
 
Adobe Summit 2015 - Penguin Random House - Accelerating Digital Transformation
Adobe Summit 2015 - Penguin Random House - Accelerating Digital TransformationAdobe Summit 2015 - Penguin Random House - Accelerating Digital Transformation
Adobe Summit 2015 - Penguin Random House - Accelerating Digital Transformation
 
Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...
Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...
Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...
 

Dernier

Dernier (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

Sling health Checks by Bertrand Delacretaz

  • 1. Sling  health  checks      -­‐      Bertrand  Delacretaz Tamingyour
 AEMinstances withthe
 ApacheSling HealthCheckTools BertrandDelacrétaz
 PrincipalScientist,AdobeCQ/AEMR&Dteam,Basel ApacheSlingcommitter,ASFMemberand(current)Director
 @bdelacretaz-grep.codeconsult.ch AEMHubLondon,April2014 slidesrevision2014-04–09,atslideshare.net/bdelacretaz
  • 2. Sling  health  checks      -­‐      Bertrand  Delacretaz picture: anitapeppers on morguefile.com How  can  you  trust  your   current  (fragile?)   combina?on  of  OSGi   bundles  and  configs?   ! It  needs  live   TESTING.  
  • 3. Sling  health  checks      -­‐      Bertrand  Delacretaz Test  code  in  my  produc?on  instance? picture: melschmitz on morguefile.com
  • 4. Sling  health  checks      -­‐      Bertrand  Delacretaz whatdowemeanby
 Health Checks?
  • 5. Sling  health  checks      -­‐      Bertrand  Delacretaz Health  Checks? 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
  • 6. Sling  health  checks      -­‐      Bertrand  Delacretaz Webconsoleand JMX
  • 7. Sling  health  checks      -­‐      Bertrand  Delacretaz Webconsole  /system/console/healthcheck
  • 8. Sling  health  checks      -­‐      Bertrand  Delacretaz Health  Check  MBeans  (auto-­‐created) Serviceprops
 : name,MBean,tags
  • 9. Sling  health  checks      -­‐      Bertrand  Delacretaz Health  Checks  as  JMX  Processors 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
  • 10. Sling  health  checks      -­‐      Bertrand  Delacretaz JMX  ResourceProvider curl http://localhost:8080/system/sling/monitoring/mbeans/...queriesStatus.tidy.2.json { "mbean:objectName": 
 “org.apache.sling.healthcheck:name=qs,type=HealthCheck", "sling:resourceType": "sling:mbean", "hc.name": "Query Performance", "mbean:description": "Health check", "status": "OK", "log": …
  • 11. Sling  health  checks      -­‐      Bertrand  Delacretaz herecomesthe
 big(?)





 demo! (webconsole,JMX,configuration)
  • 12. Sling  health  checks      -­‐      Bertrand  Delacretaz typicalUseCases
  • 13. Sling  health  checks      -­‐      Bertrand  Delacretaz Typical  Use  Cases System status Allbundlesup? Initialcontentready? Diskspaceok? Externalservicesok? Loadwithinbounds?(forjobs) Performance Requestspersecondok? Requestdurationok? Freememoryok? Replicationqueuesok? Configuration Securitychecklistok? Defaultaccountsdisabled? Democontentremoved? Self-test Startupsmoketests? Keephistoryofresults? ReporttoHTTPfront-end http://bit.ly/Qjxh93 TalktoJustinEdelson!
  • 14. Sling  health  checks      -­‐      Bertrand  Delacretaz Sling  devops  experiments https://github.com/bdelacretaz/ sling-devops-vol1 Health checks tell the cluster controller when a Sling instance is ready to be injected in the cluster.
  • 15. Sling  health  checks      -­‐      Bertrand  Delacretaz whatdoyouget
 Outofthebox?
  • 16. Sling  health  checks      -­‐      Bertrand  Delacretaz Out  of  the  Box  -­‐  core JmxAttributeHealthCheck ScriptableHealthCheck CompositeHealthCheck Single JMX attributes Script(let)s in any language
 using BindingValuesProviders
 Run other Health Checks based on their tags
  • 17. Sling  health  checks      -­‐      Bertrand  Delacretaz Out  of  the  box  -­‐  support  bundle 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.samples JUnitHealthCheck And also: From the junit.healthcheck bundle
  • 18. Sling  health  checks      -­‐      Bertrand  Delacretaz howdoyouwrite
 YourownHealth Checks?
  • 19. Sling  health  checks      -­‐      Bertrand  Delacretaz BYOHC  -­‐  Bring  Your  Own  HCs  ! @Component(...policy=ConfigurationPolicy.REQUIRE, metatype=true) @Service(value=HealthCheck.class) ! @Property(name=HealthCheck.NAME), @Property(name=HealthCheck.TAGS,unbounded=PropertyUnbounded.ARRAY), @Property(name=HealthCheck.MBEAN_NAME) ! public class MyHealthCheck { public Result execute() { FormattingResultLog f = new FormattingResultLog(); ... if(badThings) f.warn(“Something happened with {}”, foo); return new Result(f); } }
  • 20. Sling  health  checks      -­‐      Bertrand  Delacretaz HealthChecksExecutor
  • 21. Sling  health  checks      -­‐      Bertrand  Delacretaz Health  Check  Executor  Service public interface HealthCheckExecutor { ! List<HealthCheckExecutionResult>
 execute(String... tags); ! } ExecutesHCsselectedbytags,withcaching. Resultincludesexecutionmetadata,timeoutinfoetc.
  • 22. Sling  health  checks      -­‐      Bertrand  Delacretaz docs at sling.apache.org : bundles : health check. discuss on the Apache Sling dev list. I’m @bdelacretaz - thanks! JMX processors Webconsole JmxAttributeHealthCheck ScriptableHealthCheck CompositeHealthCheck SlingRequestStatusHC DefaultLoginsHealthCheck JUnitHealthCheck That’s  it!  Have  fun. @Service(HealthCheck.class)
 public class MyHealthCheck { ....generate a Result here… }