postfinance / discovery Goto Github PK
View Code? Open in Web Editor NEWService discovery for prometheus.
License: MIT License
Service discovery for prometheus.
License: MIT License
The following happens if a config file is not readable:
discovery --help
panic: ~/.config/discovery/config.yaml: open /home/user/.config/discovery/config.yaml: permission denied
goroutine 1 [running]:
github.com/alecthomas/kong.Parse(0xacf6c0, 0xc000260000, 0xc000184b00, 0x8, 0x8, 0x22)
/home/rz/golang/pkg/mod/github.com/alecthomas/[email protected]/global.go:11 +0x145
main.main()
Created upstream pull request: alecthomas/kong#163
In order that systemd post script is always successfull
Otherwise prometheus is not happy:
Mar 15 16:37:53 example.com prometheus[54858]: level=error ts=2021-03-15T15:37:53.780Z caller=file.go:237 component="discovery manager scrape" discovery=file msg="Error adding file watch" path=/appl/prometheus/service-discovery/p1-example.com/systemd err="no such file or directory"
The option "--selector-filter" does not work as the match is executed against labels and not against the selector field of the service:
// ServiceBySelector filters Services by Selector.
func ServiceBySelector(selector labels.Selector) FilterFunc {
return func(s Service) bool {
return selector.Matches(s.Labels)
}
}
Get "http://example.com:9549/metrics": dial tcp: lookup example.com on 192.168.1.1:53: no such host
<configured-directory>/servers/<servername>/<namespace>/default/<jobname>.json
<configured-directory>/servers/<servername>/<namespace>/blackbox/<jobname>.json
Für prometheus mit namen p1-prom-alsu001.pnet.ch gibt es dann folgende Konfig:
scrape_configs:
- job_name: 'default'
scrape_interval: 15s
file_sd_configs:
- files: ['/appl/prometheus/etc/service-discovery/p1-prom-alsu001.pnet.ch/default/*']
- job_name: 'k8s_kubelet'
scrape_interval: 15s
file_sd_configs:
- files: ['/appl/prometheus/etc/service-discovery/p1-prom-alsu001.pnet.ch/blackbox/*']
Es gibt zwei Registrierungsarten:
--name
, -N
: filter by job name--selector
. -s
: filter by label selector--endpoint
, -e
: filter by endpoint--server
, -S
: filter by serverImplement the http_sd
This is showed:
discovery svc register -h
Usage: discovery service register --oidc-endpoint=STRING --oidc-client-id=STRING --endpoint=STRING --namespace="default" [<name>]
instead of:
discovery svc register -h
Usage: discovery service register --oidc-endpoint=STRING --oidc-client-id=STRING --endpoint=STRING --namespace="default" <name>
This should be fixed upstream: alecthomas/kong#153
example situation: 2 prometheus instances promA and promB, 4 endpoints. Endpoints A, B and C have 400 samples, while endpoint D has 3'000.
Currently, endpoints will be distributed to something like this:
promA: A + B = 800 samples
promB: C + D = 3'400 samples
ideally, endpoints will be distributed to better distribute samples instead of endpoints...
promA: A + B + C = 1'200 samples
promB: D = 3'000 samples
...or a reasonable mix thereof
When a service is unregistered, the exporter logs the following error:
2021-05-18T10:43:37.913+0200 ERROR exporter/exporter.go:188 failed to delete service {"namespace": "systemd", "id": "190196c8-5ba9-5a4c-a6db-8a017d88180b", "err": "not found"
for services which the exporter is not configured for. This error occurs, when the exporter wants to delete a service form its cache. But since the exporter only caches services it one prometheus server, this service never existed in this cache.
Trim leading (and trailing?) spaces from labels while registering (or correctly tokenize input).
E.g. following register command has a label ("label2") which has a leading space after registering with prometheus:
discovery service register -e http://example.com/metrics example --labels=label1=value1, label2=value2
Scraping in Prometheus won't work and logs the following error:
Apr 20 11:11:40 foobar prometheus[536382]: level=error ts=2021-04-20T09:11:40.078Z caller=file.go:344 component="discovery manager scrape" discovery=file msg="Error reading file" path=/appl/prometheus/service-discovery/foobar/appl/MY_APP.json err="\" label2\" is not a valid label name"
Maybe, the same issue also applies to label values.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.