> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# System metrics with Prometheus

Anaconda Server system performance can be monitored to understand system health, evaluate network traffic, and detect issues. Each of the Anaconda Server services expose a set of metrics that can be visualized using the built-in Prometheus expression browser. Metrics are provided in [OpenMetrics](https://openmetrics.io/) (Prometheus) format.

## Accessing Prometheus

To access your system metrics from the UI, click on the **My account** button in the top right, and then click **Metrics**.
This will open a new browser tab with the root URL of the Anaconda Server installation appended with */prometheus/*. For example, *[https://yourcompany.com/prometheus/](https://yourcompany.com/prometheus/)*.

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/GAawxvWy-HUVSCqf/images/prometheus_access.png?fit=max&auto=format&n=GAawxvWy-HUVSCqf&q=85&s=be314888670eae63035654b81a045fac" alt="" width="3255" height="1612" data-path="images/prometheus_access.png" />
</Frame>

Alternatively, you can add `/prometheus` to the root URL of the Anaconda Server installation.

## Using the expression browser

Prometheus uses a built-in expression browser for time series visualizations of system metrics.

Follow these steps to create visualizations from the expression browser:

1. Select a metric from the dropdown by clicking in the cell that reads *insert metric at cursor*.
2. Click on the **Graph** tab.
3. Select a time period. Anaconda recommends two weeks ("2w").
4. Select an "until" date, that being the point in time up to which the selected metric will displayed on the graph. The default time is the current date and time.
5. Click **Execute**.

A graph will be populated with the selected metric, and a console readout will appear beneath it.

<Tip>
  You can isolate a single resource by clicking it in the legend below the graph.
</Tip>

## Popular metrics

### up

While not the most exciting graph, the `up` time metric tells you if your instance is indeed running.

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/u4MsRLDCM8Pedgc_/images/up_metric.png?fit=max&auto=format&n=u4MsRLDCM8Pedgc_&q=85&s=25d1b0942b7866772354e6802240a451" alt="" width="1567" height="701" data-path="images/up_metric.png" />
</Frame>

### process\_open\_fds

`process_open_fds` counts the number of files in `/proc/PID/fd` directory.
This tells you how many regular files, sockets, pseudo terminals, and other processes you currently have open.

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/GAawxvWy-HUVSCqf/images/process_open_fds.png?fit=max&auto=format&n=GAawxvWy-HUVSCqf&q=85&s=9714964bd66a502365dde16ad9b6d588" alt="" width="1435" height="703" data-path="images/process_open_fds.png" />
</Frame>

### process\_max\_fds

`process_max_fds` reads `/proc/<PID>/limits` and uses the **Soft Limit** from the **Max Open Files** row.
Interestingly, `/limits` lists both soft and hard limits. The soft limit is the value the kernel enforces for the corresponding resource,
while the hard limit acts as the ceiling for the soft limit.

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/GAawxvWy-HUVSCqf/images/process_max_fds.png?fit=max&auto=format&n=GAawxvWy-HUVSCqf&q=85&s=b28c2cd77c1030878b78fc3abd5f013e" alt="" width="1439" height="704" data-path="images/process_max_fds.png" />
</Frame>

## Setting a file limit alert

Using the two metrics above, `process_open_fds` and `process_max_fds`, you can quickly
write an alert to warn you when a process hits, say, 80% of the limit:

```sh theme={null}
groups:
- name: example
  rules:
  - alert: ProcessNearFDLimits
    expr: process_open_fds / process_max_fds > 0.8
    for: 10m
```
