Skip to content

Commit 15aa02f

Browse files
Lackshandave-finlay
authored andcommitted
Add stats source for metrics from backup archives
This change adds a new type of stats source called BackupStatsFiles that generates Prometheus metrics from backup archives via the cbmstatparser utility that is included in the backup repository. This use of Promtimer can be invoked with the --backup-archive-path argument and starts Promtimer with a different out-of-the-box dashboard built off these backup archive metrics.
1 parent 06c4233 commit 15aa02f

11 files changed

+767
-54
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.iml
22
*.iml~
3+
.vscode
34
promtimer/__pycache__/
45
.promtimer

README.md

+41-14
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ interested in:
1717
## Idea
1818
Promtimer:
1919

20-
1. When running against cbcollects, starts a Prometheus server for each
20+
1. When running against cbcollects, starts a Prometheus server for each
2121
cbcollect you are interested in exploring. (When run against a live
2222
cluster this step is not necessary.)
23-
1. Generates a convenient Grafana configuration with anonymous login, a
23+
1. Generates a convenient Grafana configuration with anonymous login, a
2424
custom home dashboard, data sources and dashboards.
2525
1. Starts Grafana allowing you to login and browse dashboards that collect
2626
metrics from across each node in the cluster.
2727
1. Creates dashboard annotations based on important events that happened in
28-
the cbcollect, taking information from the `diag.log` (or from an
28+
the cbcollect, taking information from the `diag.log` (or from an
2929
`events.log` file generated by the Event Logger) or from the `/logs` REST
3030
API.
3131

@@ -45,9 +45,9 @@ For offline browsing of stats, you will additionally need:
4545
* (Optional) Event Logger from [cbmultimanager](https://github.com/couchbaselabs/cbmultimanager)
4646
if you wish to generate an `events.log` file
4747

48-
If you happen to be building Couchbase Server 7.0 or later, you will already
49-
have a Prometheus binary: it's in the `install/bin` directory of one of your
50-
local builds. If you don't, the [Getting Started](https://prometheus.io/docs/introduction/first_steps/)
48+
If you happen to be building Couchbase Server 7.0 or later, you will already
49+
have a Prometheus binary: it's in the `install/bin` directory of one of your
50+
local builds. If you don't, the [Getting Started](https://prometheus.io/docs/introduction/first_steps/)
5151
instructions on the Prometheus website are comprehensive. You don't actually
5252
need to install Prometheus, you just need the binary. [Downloading](https://prometheus.io/download/)
5353
and unzipping the pre-compiled binaries for your platform is sufficient.
@@ -56,7 +56,7 @@ If you're on Mac,`brew` is convenient:
5656

5757
brew install prometheus
5858

59-
It's also possible to build Prometheus from source yourself. This is
59+
It's also possible to build Prometheus from source yourself. This is
6060
straightforward:
6161

6262
```
@@ -65,9 +65,9 @@ cd prometheus
6565
make prometheus
6666
```
6767

68-
You'll need a full Grafana install. The `grafana-server` binary alone isn't
69-
sufficient as Grafana ships with many configuration files.
70-
[Installation instructions](https://grafana.com/docs/grafana/latest/installation/)
68+
You'll need a full Grafana install. The `grafana-server` binary alone isn't
69+
sufficient as Grafana ships with many configuration files.
70+
[Installation instructions](https://grafana.com/docs/grafana/latest/installation/)
7171
on the Grafana website look comprehensive. Follow the instructions for your
7272
platform to get a recent version of Grafana. On Mac, it's easy:
7373

@@ -78,10 +78,16 @@ To get Promtimer, clone this repo locally:
7878
git clone https://github.com/couchbaselabs/promtimer.git
7979

8080
As to cbcollects, you probably wouldn't be reading this if you didn't already
81-
have them.
81+
have them.
8282

83-
## How to Use Promtimer for Offline Analysis
83+
### cbbackupmgr stats files
84+
For visualisation of cbbackupmgr stats files, you'll also need access to the private
85+
`backup` repository in order to use the `cbmstatparser` utility. You'll need to
86+
either add the cbmstatparser binary to your path or manually specify it with the
87+
`--cbmstatparser-path` flag.
8488

89+
## How to Use Promtimer for Offline Analysis
90+
### Visualising CBCollects
8591
Assemble the cbcollects in a directory. It's fine if you unzip them, but it's not
8692
necessary.
8793

@@ -113,6 +119,27 @@ The Grafana dashboards page should open for you automatically. If not, navigate
113119
to `localhost:13300/dashboards` in your browser and begin exploring the
114120
available dashboards.
115121

122+
### Visualising cbbackupmgr stats files
123+
Ensure that you have access to either a backup archive or a cbbackupmgr collect zip
124+
file.
125+
126+
Start Promtimer:
127+
128+
```bash
129+
promtimer --backup-archive-path <path-to-backup-archive-or-zip>
130+
```
131+
132+
The above command assumes that `cbmstatparser` is available on your PATH. If it isn't,
133+
you'll need to specify the location of the `cbmstatparser` binary manually via the
134+
`--cbmstatparser-path` flag.
135+
136+
The `path-to-backup-archive-or-zip` specifies the path to either a backup archive or to
137+
a cbbackupmgr collect zip file.
138+
139+
The Grafana dashboards page should open for you automatically. If not, navigate
140+
to `localhost:13300/dashboards` in your browser and begin exploring the
141+
available dashboards.
142+
116143
## How to Use Promtimer for Online Monitoring
117144

118145
Start Promtimer and provide the URL to the cluster and the name of the user that
@@ -130,8 +157,8 @@ the `/logs` REST API in the online case) and create dashboard annotations in Gra
130157
for important system events.
131158

132159
As an option, Promtimer also supports the creating annotations based on an `events.log`
133-
file for system events generated by the Event Logger in the
134-
[cbmultimanager](https://github.com/couchbaselabs/cbmultimanager) repository. Read
160+
file for system events generated by the Event Logger in the
161+
[cbmultimanager](https://github.com/couchbaselabs/cbmultimanager) repository. Read
135162
[here](EVENTS.md) for more information on the Event Logger.
136163

137164
## Clean Up

0 commit comments

Comments
 (0)