You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by wi...@apache.org on 2023/04/12 02:23:24 UTC

[yunikorn-site] branch master updated: [YUNIKORN-1625] [ADDENDUM] Adding a document of setting prometheus in the user guide (#285)

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

wilfreds 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 cf29e7e16 [YUNIKORN-1625] [ADDENDUM] Adding a document of setting prometheus in the user guide (#285)
cf29e7e16 is described below

commit cf29e7e16ad53713f14125b413829e52c1e5dc63
Author: 0yukali0 <a0...@gmail.com>
AuthorDate: Wed Apr 12 12:22:59 2023 +1000

    [YUNIKORN-1625] [ADDENDUM] Adding a document of setting prometheus in the user guide (#285)
    
    Closes: #285
    
    Signed-off-by: Wilfred Spiegelenburg <wi...@apache.org>
---
 .../current/user_guide/prometheus.md               | 82 ++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/i18n/zh-cn/docusaurus-plugin-content-docs/current/user_guide/prometheus.md b/i18n/zh-cn/docusaurus-plugin-content-docs/current/user_guide/prometheus.md
new file mode 100644
index 000000000..4ded82ff1
--- /dev/null
+++ b/i18n/zh-cn/docusaurus-plugin-content-docs/current/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