This is an automated email from the ASF dual-hosted git repository.

yuteng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-site.git


The following commit(s) were added to refs/heads/master by this push:
     new 414b458a7 Adding a document of setting prometheus in the user guide 
(#283)
414b458a7 is described below

commit 414b458a7ab95c6a82bd007bd08c4c6b92fa387d
Author: wusamzong <[email protected]>
AuthorDate: Thu Mar 30 00:28:35 2023 +0800

    Adding a document of setting prometheus in the user guide (#283)
---
 docs/assets/prometheus-cmd.png    | Bin 0 -> 542991 bytes
 docs/assets/prometheus-web-ui.png | Bin 0 -> 324110 bytes
 docs/get_started/get_started.md   |   3 ++
 docs/user_guide/prometheus.md     |  82 ++++++++++++++++++++++++++++++++++++++
 sidebars.js                       |   1 +
 5 files changed, 86 insertions(+)

diff --git a/docs/assets/prometheus-cmd.png b/docs/assets/prometheus-cmd.png
new file mode 100644
index 000000000..86bfc6a49
Binary files /dev/null and b/docs/assets/prometheus-cmd.png differ
diff --git a/docs/assets/prometheus-web-ui.png 
b/docs/assets/prometheus-web-ui.png
new file mode 100644
index 000000000..b4519765a
Binary files /dev/null and b/docs/assets/prometheus-web-ui.png differ
diff --git a/docs/get_started/get_started.md b/docs/get_started/get_started.md
index 39c11f10e..c0233b65d 100644
--- a/docs/get_started/get_started.md
+++ b/docs/get_started/get_started.md
@@ -78,3 +78,6 @@ Once this is done, web UI will be available at: 
`http://localhost:9889`.
 
 YuniKorn UI provides a centralised view for cluster resource capacity, 
utilization, and all application info.
 
+Besides, YuniKorn also exposes its scheduling metrics via Prometheus.
+
+If you want to monitor the yunikorn core services by using Prometheus, you can 
find our step-by-step tutorial [here](../user_guide/prometheus.md).
\ No newline at end of file
diff --git a/docs/user_guide/prometheus.md b/docs/user_guide/prometheus.md
new file mode 100644
index 000000000..8a2c6e456
--- /dev/null
+++ b/docs/user_guide/prometheus.md
@@ -0,0 +1,82 @@
+---
+id: prometheus
+title: Setting Prometheus
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+YuniKorn exposes its scheduling metrics via Prometheus. Thus, we need to set 
up a Prometheus server to collect these metrics.
+
+If you don't know what metric can be used, you can use [REST 
API](../api/scheduler.md#metrics).
+
+### 1. **Download Prometheus release**
+
+```bash
+wget 
https://github.com/prometheus/prometheus/releases/download/v2.30.3/prometheus-2.30.3.linux-amd64.tar.gz
+```
+
+```bash
+tar xvfz prometheus-*.tar.gz
+cd prometheus-*
+```
+
+### 2. **Configure prometheus.yml**
+
+Prometheus collects metrics from *targets* by scraping metrics HTTP endpoints.
+
+```yaml
+global:
+  scrape_interval:     3s
+  evaluation_interval: 15s
+
+scrape_configs:
+  - job_name: 'yunikorn'
+    scrape_interval: 1s
+    metrics_path: '/ws/v1/metrics'
+    static_configs:
+    - targets: ['localhost:9080'] 
+    # 9080 is internal port, need port forward or modify 9080 to service's port
+```
+
+### 3. Start port-forward
+
+Port forwarding for the core's web service on the standard port can be turned 
on via:
+
+```bash
+kubectl port-forward svc/yunikorn-service 9080:9080 -n yunikorn
+```
+
+`9080`is the default port for core's web service. 
+
+### 4. Execute prometheus
+
+```bash
+./prometheus --config.file=prometheus.yml
+```
+
+![prometheus-cmd](../assets/prometheus-cmd.png)
+
+### 5. Access the Prometheus UI
+
+You should be able to browse to a status page at 
[localhost:9090](http://localhost:9090/). Give it a couple of seconds to 
collect data about itself from its own HTTP metrics endpoint.
+
+![prometheus-web-ui](../assets/prometheus-web-ui.png)
+
+You can also verify that Prometheus is serving metrics by navigating to its 
metrics endpoint:[localhost:9090/metrics](http://localhost:9090/metrics)
\ No newline at end of file
diff --git a/sidebars.js b/sidebars.js
index 4897aa436..7b6e9c14e 100644
--- a/sidebars.js
+++ b/sidebars.js
@@ -32,6 +32,7 @@ module.exports = {
             'user_guide/resource_quota_management',
             'user_guide/gang_scheduling',
             'user_guide/labels_and_annotations_in_yunikorn',
+            'user_guide/prometheus',
             {
                 type: 'category',
                 label: 'Workloads',

Reply via email to