Skip to content

Grafana Agent

Grafana agent

Grafana Agent is an open-source, telemetry collection software released by Grafana Labs. It's designed with performance and observability in mind, and it works hand-in-hand with various Grafana-based offerings, including Observe by Cyso. While the agent stands as a foundation for gathering monitoring data, it should not be confused with full standalone monitoring software. Its primary task is to collect metrics, logs, and traces, then transmit these to an analytics or visualization tool.

The agent is a lightweight, highly-efficient, and simpler fragment of Prometheus that incorporates the best features of both Prometheus and Grafana Labs systems. This includes Prometheus's service discovery, metadata, and relabeling. By architecting the agent this way, it significantly reduces the memory footprint and resource requirements.

Official Grafana Agent Documentation

Grafana Agent has a detailed and extensive official documentation which includes comprehensive guides on installation, configuration, and usage. You can refer to it for better understanding and effective usage of the tool.

Official Grafana Agent Documentation GitHub grafana/agent

This documentation focusses on how to use Grafana Agent with our observability platform.

Configuration

To configure the Grafana Agent to forward logs to the Observe by Cyso endpoint, you must specify a remote loki endpoint and specify which log files you want to watch. This configuration allows for immediate transmission of scraped logs to a specified loki endpoint. The following guide details the configuration steps you'll need to follow within the Grafana Agent’s environment.

Prerequisites

To proceed with the configuration, ensure that:

  1. Grafana Agent is installed and operational.
  2. You have administrative access to your Grafana Agent server.
  3. Your Cyso customer ID and API key are available.

Configuration Steps

  1. Open the Grafana Agent configuration file, which is typically named agent-config.yaml. You can find this file in the configuration directory where Grafana Agent is installed.

  2. Add a logs section to your configuration file with Loki as the output. Here's an example configuration:

    logs:
      configs:
        - name: observe_by_cyso_logs
          positions: /tmp/positions.yaml
          scrape_configs:
            - job_name: varlogs
                static_configs:
                - targets: [localhost]
                    labels:
                    job: varlogs
                    __path__: /var/log/*log
          clients:
            - url: https://api.ams2.observe.cyso.com/{customer_id}}/logs
              tenant_id: '{customer_id}'
              basic_auth:
                username: '{customer_id}'
                password: '{token}'
    

    Note

    You should replace {customer_id} with your actual Cyso Customer ID and {token} with your received API key.

    Warning

    This example configuration will watch all files ending with .log in the /var/log folder on your system, and send them to Loki. Make sure you verify that is exactly what you want. There may be sensitive log files in this location on your system.

  3. Save the file and close it.

  4. After making the configuration changes, restart Grafana Agent to apply the new settings.

Further, you can validate that the configuration is operating appropriately by reviewing the Grafana Agent logs to ensure the metrics are being pushed successfully. Any errors arising will be detailed in these logs.

If there are issues during setup, ensure your Grafana Agent service is active, double-check your inputted credentials, and examine the Grafana Agent logs for any discernible errors.

Troubleshooting

If you encounter issues during setup:

  • Confirm the Grafana Agent service is running.
  • Review the Grafana Agent logs for any errors.
  • Check the supplied credentials for accuracy. Incorrect credentials will inhibit metric writing.

In case you need additional assistance, contact Cyso's support team.