From 986adfa5572a5d1398a3cbd66192182f589b3eaf Mon Sep 17 00:00:00 2001 From: Conor Hennessy Date: Thu, 10 Oct 2013 20:53:19 +0200 Subject: [PATCH 1/2] Update example config file from json to new protobuf format. Change-Id: I38646c2be53b6993abe464d9cdd9b211678de496 --- documentation/examples/prometheus.conf | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/documentation/examples/prometheus.conf b/documentation/examples/prometheus.conf index 0ed17b439..7e99e739f 100644 --- a/documentation/examples/prometheus.conf +++ b/documentation/examples/prometheus.conf @@ -1,24 +1,26 @@ global { - scrape_interval = "1s" - evaluation_interval = "1s" + scrape_interval: "1s" + evaluation_interval: "1s" labels { - monitor = "test" + label { + name: "owner" + value: "test" + } } - rule_files = [ - "prometheus.rules" - ] + rule_file: "prometheus.rules" } job { - name = "prometheus" - scrape_interval = "5s" + name: "prometheus" + scrape_interval: "5s" - targets { - endpoints = [ - "http://localhost:9090/metrics.json" - ] + target_group { + target: "http://localhost:9090/metrics.json" labels { - group = "canary" + label { + name: "group" + value: "canary" + } } } } From 2d2c434d48ef48d9eec3fed5b7fb8a5dcca267de Mon Sep 17 00:00:00 2001 From: Conor Hennessy Date: Tue, 15 Oct 2013 12:08:29 +0200 Subject: [PATCH 2/2] More updates for first time users. - Modified sample conf so it is useable by default, also added some comments from the 'hello world' configuration. - Updated README so there's a clear two step start for newbies. - Added extra vim swap files to gitignore. Change-Id: I76203973db4a7b332014662fcfb2ce5e7d137bd8 --- .gitignore | 5 ++++ README.md | 12 ++++----- documentation/examples/prometheus.conf | 34 ++++++++++++++------------ 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 16bfed94a..d283e6f16 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,13 @@ *.pyc *.rej *.so + +# Editor files # +################ *~ .*.swp +.*.swo + .DS_Store ._* .nfs.* diff --git a/README.md b/README.md index db3992eee..43a999940 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,11 @@ For basic help how to get started: For first time users, simply run the following: $ make + $ ARGUMENTS="-configFile=documentation/examples/prometheus.conf" make run + +``${ARGUMENTS}`` is passed verbatim into the makefile and thusly Prometheus as +``$(ARGUMENTS)``. This is useful for quick one-off invocations and smoke +testing. If you run into problems, try the following: @@ -56,13 +61,6 @@ staticly link against C dependency libraries, so including the ``lib`` directory is paramount. Providing ``LD_LIBRARY_PATH`` or ``DYLD_LIBRARY_PATH`` in a scaffolding shell script is advised. -Executing the following target will start up Prometheus for lazy users: - - $ ARGUMENTS="-foo -bar -baz" make run - -``${ARGUMENTS}`` is passed verbatim into the makefile and thusly Prometheus as -``$(ARGUMENTS)``. This is useful for quick one-off invocations and smoke -testing. ### Problems If at any point you run into an error with the ``make`` build system in terms of diff --git a/documentation/examples/prometheus.conf b/documentation/examples/prometheus.conf index 7e99e739f..f86251919 100644 --- a/documentation/examples/prometheus.conf +++ b/documentation/examples/prometheus.conf @@ -1,26 +1,30 @@ +# Global default settings. global { - scrape_interval: "1s" - evaluation_interval: "1s" - labels { - label { - name: "owner" - value: "test" + scrape_interval: "15s" # By default, scrape targets every 15 seconds. + evaluation_interval: "15s" # By default, evaluate rules every 15 seconds. + + # Attach these extra labels to all timeseries collected by this Prometheus instance. + labels: { + label: { + name: "monitor" + value: "codelab-monitor" } } - rule_file: "prometheus.rules" + + # Load and evaluate rules in this file every 'evaluation_interval' seconds. This field may be repeated. + #rule_file: "prometheus.rules" } -job { +# A job definition containing exactly one endpoint to scrape: Here it's prometheus itself. +job: { + # The job name is added as a label `job={job-name}` to any timeseries scraped from this job. name: "prometheus" + # Override the global default and scrape targets from this job every 5 seconds. scrape_interval: "5s" - target_group { + # Let's define a group of targets to scrape for this job. In this case, only one. + target_group: { + # These endpoints are scraped via HTTP. target: "http://localhost:9090/metrics.json" - labels { - label { - name: "group" - value: "canary" - } - } } }