Configuration¶
Sample Config¶
<?xml version="1.0" encoding="UTF-8"?>
<calibre-metrics>
<read interval="5"/>
<sink>
<!-- <prometheus bind="127.0.0.1:8080"/> -->
<!-- <influxdb-v1 address="http://127.0.0.1:8087" database="foobar"
username="paul" password="timeseries4days"/> -->
</sink>
<library label="default" db-path="/Users/citruspi/Calibre Library/metadata.db"/>
<metrics>
<authors/>
<books/>
<bytes/>
<files/>
<formats/>
<languages/>
<publishers/>
<series/>
<tags/>
<books-by-author label-by="id"/>
<books-wo-author/>
<books-by-language/>
<books-wo-language/>
<books-by-publisher label-by="value"/>
<books-wo-publisher/>
<books-by-series label-by="id"/>
<books-wo-series/>
<books-by-tag label-by="value"/>
<books-wo-tag/>
<bytes-by-format/>
<files-by-format/>
<internal/>
</metrics>
</calibre-metrics>
Read¶
- Only one read config may be specified.
- If no read config is specified, calibre-metrics will read the libraries on an interval of
30 seconds
by default.
Interval¶
The interval
attribute on the read
element determines how frequently (in seconds) calibre-metrics should poll the library databases for updates.
Sink¶
- Only one sink may be configured.
- If no sink is configured, calibre-metrics will expose a Prometheus endpoint at
http://127.0.0.1:7323/metrics
by default.
InfluxDB v1¶
Anonymous¶
<sink>
<influxdb-v1 address="http://127.0.0.1:8087" database="foobar"/>
</sink>
Authenticated¶
<sink>
<influxdb-v1 address="http://127.0.0.1:8087" database="foobar"
username="foo" password="bar"/>
</sink>
Prometheus¶
<sink>
<prometheus bind="127.0.0.1:7323"/>
</sink>
Libraries¶
- If no libraries are configured, calibre-metrics will attempt to use the library located at
~/Calibre Library/metadata.db
. - Multiple libraries can be monitored - simply define additional
library
tags
The db-path
attribute on the library
tag should be a relative or absolute path to a Calibre library database file
Warning
Tildes, environment variables, etc. will not be expanded.
<library db-path="/Users/citruspi/Calibre/Periodicals/metadata.db"/>
<!-- or -->
<library db-path="../Periodicals/metadata.db"/>
Labels¶
Metrics for each library will be exported with the library path as a metric tag. For example
calibre_books{library="/Users/citruspi/Calibre/Periodicals/metadata.db"} 33
However, you may override the value of a tag with the label
attribute:
<library label="periodicals" db-path="/Users/citruspi/Calibre/Periodicals/metadata.db"/>
which would result in
calibre_books{library="periodicals"} 33
Metrics¶
authors¶
The authors
tag will export an authors
representing the number of authors in the Calibre library.
<authors/>
books¶
The books
tag will export a books
metric representing the number of eBooks in the Calibre library.
<books/>
bytes¶
The bytes
tag will export a bytes
metric representing the cumulative size of the eBook files in the Calibre library.
<bytes/>
files¶
The files
tag will export a files
metric representing the number of eBook files in the Calibre library.
<files/>
formats¶
The formats
tag will export a formats
metric representing the number of eBooks file formats present in the Calibre library (e.g. PDF, MOBI, ePub, etc.).
<formats/>
languages¶
The languages
tag will export a languages
metric representing the number of languages in the Calibre library.
<languages/>
publishers¶
The publishers
tag will export a publishers
metric representing the number of publishers in the Calibre library.
<publishers/>
series¶
The series
tag will export a series
metric representing the number of series in the Calibre library.
<series/>
tags¶
The tags
tag will export a tag
metric representing the number of tags in the Calibre library.
<tags/>
books-by-author¶
The books-by-author
tag will export a books_by_author
metric representing the number of books for each author in the Calibre library. The author will be exposed as a metric tag.
<books-by-author/>
Labels¶
The value of the author
tag on the books_by_author
metric can either be the name of the author or their ID in the Calibre database. It is possible to configure the value with the label-by
attribute.
Author ID:
<books-by-author label-by="ID"/>
or
Author Name:
<books-by-author label-by="VALUE"/>
books-wo-author¶
The books-wo-author
tag will export a books_wo_author
metric representing the number of books in the Calibre library that are not associated with any author.
<books-wo-author/>
books-by-language¶
The books-by-language
tag will export a books_by_language
metric representing the number of books for each author in the Calibre library. The language will be exposed as a metric tag.
<books-by-language/>
books-wo-language¶
The books-wo-language
tag will export a books_wo_language
metric representing the number of books in the Calibre library that are not associated with any language.
<books-wo-language/>
books-by-publisher¶
The books-by-publisher
tag will export a books_by_publisher
metric representing the number of books for each author in the Calibre library. The publisher will be exposed as a metric tag.
<books-by-publisher/>
Labels¶
The value of the publisher
tag on the books_by_publisher
metric can either be the name of the language or their ID in the Calibre database. It is possible to configure the value with the label-by
attribute.
Publisher ID:
<books-by-publisher label-by="ID"/>
or
Publisher Name:
<books-by-publisher label-by="VALUE"/>
books-wo-publisher¶
The books-wo-publisher
tag will export a books_wo_publisher
metric representing the number of books in the Calibre library that are not associated with any publisher.
<books-wo-publisher/>
books-by-series¶
The books-by-series
tag will export a books_by_series
metric representing the number of books for each series in the Calibre library. The series will be exposed as a metric tag.
<books-by-series/>
Labels¶
The value of the series
tag on the books_by_series
metric can either be the name of the series or their ID in the Calibre database. It is possible to configure the value with the label-by
attribute.
Series ID:
<books-by-series label-by="ID"/>
or
Series Name:
<books-by-series label-by="VALUE"/>
books-wo-series¶
The books-wo-series
tag will export a books_wo_series
metric representing the number of books in the Calibre library that are not associated with any series.
<books-wo-series/>
books-by-tag¶
The books-by-tag
tag will export a books_by_tag
metric representing the number of books for each tag in the Calibre library. The tag will be exposed as a metric tag.
<books-by-tag/>
Labels¶
The value of the tag
tag on the books_by_tag
metric can either be the name of the tag or their ID in the Calibre database. It is possible to configure the value with the label-by
attribute.
Tag ID:
<books-by-tag label-by="ID"/>
or
Tag Name:
<books-by-tag label-by="VALUE"/>
books-wo-tag¶
The books-wo-tag
tag will export a books_wo_tag
metric representing the number of books in the Calibre library that are not associated with any tag.
<books-wo-tag/>
bytes-by-format¶
The bytes-by-format
tag will export a bytes_by_format
metric representing the cumulative size of all eBook files in the Calibre library for each file format. The format will be exposed as a metric tag.
<bytes-by-format/>
files-by-format¶
The files-by-format
tag will export a files_by_format
metric representing the number of eBook files in the Calibre library for each file format. The format will be exposed as a metric tag.
<files-by-format/>
internal¶
The internal
tag will export two metrics:
calibre_metrics_derive_ms
- the time elapsed while calculating metrics per library (with the library exposed as a metric tag)calibre_metrics_derive_ms_total
- cumulative time elapsed while calculating metrics for all libraries
<internal/>