# PerfectScale Agent

{% hint style="info" %}
For large clusters, if you are not using automation, use PerfectScale’s recommendations for `psc-exporter` to properly size it.
{% endhint %}

PerfectScale Exporter installed in your Kubernetes cluster provides helpful [metrics](#metrics) for monitoring, reviewing, and alerting on PerfectScale platform behavior. These metrics will instantly detect abnormal behavior and notify you through [alerts](#alerts).

## Metrics

The Exporter presents metrics in the Prometheus format and utilizes two categories of metrics:

1. Counter - the increasing metric
   * [ksm\_scraping\_errors\_total](#ksm_scraping_errors_total)
   * [cadvisor\_scraping\_errors\_total](#cadvisor_scraping_errors_total)
   * [time\_windows\_upload\_errors\_total](#time_windows_upload_errors_total)
   * [auth\_errors\_total](#auth_errors_total)
   * [upload\_policy\_errors\_total](#upload_policy_errors_total)
2. Gauge - system state at a specific time point. This metric can go down and can go up.
   * [ksm\_instances\_scraped](#ksm_instances_scraped)
   * [cadvisor\_instances\_scraped](#cadvisor_instances_scraped)

PerfectScale Exporter takes [Kube State Metrics (KSM)](#ksm-metrics) and [cAdvisor Metrics](#cadvisor-metrics) as inputs and uploads [compressed metrics to PerfectScale SaaS](#perfectscale-metrics) as output.

### KSM Metrics

These metrics monitor the communication between the Exporter and the KSM in your cluster.

#### ksm\_instances\_scraped

* **Metric Name**: `psc_exporter_ksm_instances_scraped`
* **Description**: The number of KSM instances the exporter tried to scrape during the latest scraping round. Usually, you have only 1.
* **Type**: Gauge

#### ksm\_scraping\_errors\_total

* **Metric Name**: `psc_exporter_ksm_scraping_errors_total`
* **Description**: A counter that grows incrementally to keep track of errors during KSM scraping.
* **Type**: Counter

### cAdvisor Metrics

cAdvisor component provides the Exporter with information on specific containers and their resource usage.

#### cadvisor\_instances\_scraped

* **Metric Name**: `psc_exporter_cadvisor_instances_scraped`
* **Description**: The number of cAdvisor instances the exporter tried to scrape during the latest scraping round.
* **Type**: Gauge

#### cadvisor\_scraping\_errors\_total

* **Metric Name**: `psc_exporter_cadvisor_scraping_errors_total`
* **Description**: A counter that grows incrementally to keep track of errors during cAdvisor scraping.
* **Type**: Counter

### PerfectScale Metrics

PerfectScale provides an additional group of metrics that pertains to exporters communicating with the PerfectScale SaaS platform.

#### time\_windows\_upload\_errors\_total

* **Metric Name**: `psc_exporter_time_windows_upload_errors_total`
* **Description**: Total number of failed attempts to upload time windows to PerfectScale.
* **Type**: Counter

#### auth\_errors\_total

* **Metric Name**: `psc_exporter_auth_errors_total`
* **Description**: Total number of PerfectScale exporter authorization errors.
* **Type**: Counter

#### upload\_policy\_errors\_total

* **Metric Name**: `psc_exporter_upload_policy_errors_total`
* **Description**: Total number of errors when updating the upload policy.
* **Type**: Counter

## Alerts

Alerts are useful in immediately informing about the abnormal behavior of the Exporter based on the [metrics](#metrics) described above.&#x20;

### How to configure the Alerts

To enable or configure the Alerts, update the Helm values according to your requirements.

#### Helm Values example

```yaml
serviceMonitor:
  enable: true

prometheusRule:
  enable: true
  labels:
    customLabel: "value"
  annotations:
    customAnnotation: "value"
  team: "operations"
  severity: "critical"
  cAdvisorScraping:
    timeRange: "15m"
    threshold: 0.5
```

### Alerts overview

#### PerfectScale Exporter High KSM Scraping Error Rate

* **Alert Name**: PerfectScale Exporter High KSM Scraping Error Rate
* **Description**: Within the last 5 minutes, over 30% of kube-state-metrics scraping attempts have failed.

#### PerfectScale Exporter High cAdvisor Scraping Error Rate

* **Alert Name**: PerfectScale Exporter High cAdvisor Scraping Error Rate
* **Description**: Over a specified percentage of cAdvisor scraping attempts have failed within the specified time range.

#### PerfectScale Exporter Time Windows Upload Error Rate

* **Alert Name**: PerfectScale exporter Time Windows Upload Error Rate
* **Description**: Within 1 hour, three or more time windows upload errors to PerfectScale occurred.

#### PerfectScale Exporter Authorization Errors

* **Alert Name**: PerfectScale exporter Authorization Errors
* **Description**: Within 1 hour, two or more PerfectScale Exporter authorization errors occurred.

#### PerfectScale Exporter Upload Policy Refresh Errors

* **Alert Name**: PerfectScale exporter Upload Policy Refresh Errors
* **Description**: Within 1 hour, two or more errors occurred when updating the upload policy.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.perfectscale.io/product-overview/perfectscale-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
