In this episode we discuss JENKINS_HOME backup strategies using the ThinBackup plugin or filesystem snapshots, complete with a from-scratch disaster recovery procedure using JCasC and backup data. We also export controller health metrics to Prometheus and visualize them in Grafana.

In episode 17 we built notifications that keep builds "talking". Now we handle the most unpleasant but most critical thing: what happens if the Jenkins controller dies? Job configuration, credentials, and build history stored in JENKINS_HOME can vanish in an instant. Without a backup, all of it must be reconfigured manually — taking hours and risking the loss of critical configuration.
In this episode we cover three things:
JENKINS_HOME directory with ThinBackup or filesystem snapshots.All of Jenkins's important data lives in a single JENKINS_HOME directory:
Losing this directory is the same as losing the team's entire automation. That is why backup is not optional but mandatory.
The ThinBackup plugin periodically backs up Jenkins configuration and jobs to a separate directory. Some of its features: scheduled automatic backups, backup rotation, and direct restore from the UI.
Configuration steps in Manage Jenkins then ThinBackup:
H 2 * * * for 2 AM.Warning
The backup directory must not be inside JENKINS_HOME. If the controller disk fails, the backup is lost too. Place it on different storage, ideally in a different region.
For extra assurance, combine it with filesystem snapshots. In the cloud, snapshot the controller instance's volume, for example an EBS snapshot or a VM disk image. On bare-metal servers, use LVM snapshots or periodic rsync.
A DR plan is a written procedure for recovering the controller from scratch. Since Jenkins is already declaratively defined via JCasC (episode 13), recovery becomes very fast. The sequence:
jenkins/jenkins:lts-jdk17 image with the same JCasC from the configuration repository.plugins.txt file) so plugin versions match.A quick command for manual restore:
sudo systemctl stop jenkins
sudo rm -rf /var/lib/jenkins
sudo tar -xzf jenkins-backup-20260803.tar.gz -C /var/lib/jenkins
sudo chown -R jenkins:jenkins /var/lib/jenkins
sudo systemctl start jenkinsTip
Test the DR periodically (e.g. quarterly): spin up a trial controller from the latest backup and run one dummy job. A backup that has never been tested is not a backup — it is just an archive.
Backups help during a disaster, but problems usually appear gradually: executors running out of slots, queues piling up, JVM memory leaks. The Prometheus Metrics plugin exposes controller metrics at the /prometheus endpoint, which is then scraped by Prometheus.
The scrape configuration in the prometheus.yml file:
scrape_configs:
- job_name: 'jenkins-controller'
metrics_path: '/prometheus'
scheme: https
static_configs:
- targets:
- 'jenkins.example.com'
basic_auth:
username: 'metrics-user'
password: 'metrics-password'
tls_config:
insecure_skip_verify: trueNote
Disable the anonymous read option in the security section, then restrict access to the /prometheus endpoint to a monitoring user only. This prevents metrics containing job names from leaking to the public.
| Metric | Meaning | Sign of Trouble |
|---|---|---|
jenkins_queue_size_value | Number of items waiting in the queue | Executors full, not enough agents |
jenkins_executor_count_value | Total executors in use | Build capacity nearly exhausted |
jenkins_jvm_memory_used_bytes | JVM heap memory in use | Potential OOM or memory leak |
jenkins_builds_running | Builds currently running | Abnormal activity |
These metrics are visualized in Grafana using the community Jenkins dashboard. After adding the Prometheus datasource in Grafana, the dashboard displays queue size, executor usage, and JVM memory graphs all at once, complete with alert rules.
An example alert rule for a piling-up queue:
groups:
- name: jenkins.rules
rules:
- alert: JenkinsQueueHigh
expr: jenkins_queue_size_value > 20
for: 5m
labels:
severity: warning
annotations:
summary: Antrian build menumpuk di JenkinsWith the combination of queue size, executor usage, and JVM memory, we can decide when to add agents or raise the JVM heap — before the controller actually stalls.
In this episode we covered HA, backup, and DR:
JENKINS_HOME stores all configuration assets, jobs, and credentials, so it must be backed up.A healthy controller is the foundation of a reliable pipeline. In episode 19 we go into detective mode: troubleshooting and debugging pipelines — from log analysis, the Replay feature, and the Snippet Generator, to handling OOM and disconnected agents. See you there!