Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

A guide to premade grafana-pcp dashboard development

November 21, 2024
Sam Feifer
Related topics:
ObservabilityOpen source
Related products:
Red Hat Enterprise Linux

    Creating Grafana dashboards from scratch can be a tedious process. To help grafana-pcp users get started visualizing Performance Co-Pilot (PCP) metrics immediately, the Performance Co-Pilot plugin for Grafana includes some premade dashboards. The grafana-pcp plug-in and the 3 included datasources each have dashboards that a user can import.

    These dashboards do a great job of getting a user started and visualizing a lot of important metrics in a useful way; however, different use cases call for different visualizations. There might be a common use case that does not yet have a premade dashboard bundled in the grafana-pcp plug-in.

    The premade dashboard files in the grafana-pcp plug-in are .jsonnet files. They can be found along with the rest of the grafana-pcp sources in the Performance Co-Pilot Grafana plug-in GitHub repository. The dashboard files are located in the following directories:

    • Plug-in dashboards: src/dashboards

    • Vector dashboards: src/datasources/vector/dashboards 

    • Redis dashboards: src/datasources/redis/dashboards 

    • bpftrace dashboards:  src/datasources/bpftrace/dashboards 

    For a new premade dashboard for the vector datasource, a new Jsonnet file would be created in src/datasources/vector/dashboards.

    Using one of the current Jsonnet files as a guide can help get the dashboard started.

    Example: Top CPU consuming processes dashboard

    Figure 1 shows the full finished dashboard and Figure 2 shows a zoomed-in view of the table from the finished dashboard. The following guide goes through developing this dashboard as a premade Jsonnet file in the grafana-pcp plug-in.

    Screenshot of the Top CPU consumers dashboard
    Figure 1: Top CPU Consumers Dashboard
    Figure 1: Top CPU consumers dashboard.
    Zoomed in view of the Top CPU consumers table
    Figure 2. Zoomed in view of the Top CPU Consumers table from the Top CPU Consumers dashboard
    Figure 2: Zoomed-in view of the Top CPU consumers table from the Top CPU consumers dashboard.

    Create a file named pcp-vector-top-cpu-consumers.jsonnet in src/datasources/vector/dashboards and on the first line, import the Grafana library for Jsonnet:

    local grafana = import 'grafonnet/grafana.libsonnet';

    Next, create the dashboard for the datasource. The example below is creating a dashboard for the PCP Vector datasource. The title of the dashboard is "Top CPU Consumers". The dashboard will display metrics from the last 5 minutes (now-5m). Every 5 seconds, the visualization will refresh (update the data). See below:

    grafana.dashboard.new(
        'Top Consumers',
        tags=['pcp-vector'],
        time_from='now-5m',
        time_to='now',
        refresh='5s',
    )
    .addTemplate(
      grafana.template.datasource(
        'datasource',
        'performancecopilot-vector-datasource',
        'PCP Vector',
      )
    )

    Now that the dashboard is set up, visualizations can be added. In this example, we are creating a table. There are examples of graph panels (time series) and other types of visualizations in the other dashboards bundled with grafana-pcp. It is recommended to use these as a guide when creating a visualization of the same type.

    This table will have the title "Top CPU Consumers" and track the proc.hog.cpu metric, which displays the amount of CPU a process is using. The table sorts the instances by their value of proc.hog.cpu in descending order. The resulting visualization lists the processes on a system by their amount of CPU consumption, which can help identify processes that may be using too much CPU.

    The size of the table is determined by the values of w and h. The table's position is denoted by the values of x and y. See below:

    .addPanel(
        grafana.tablePanel.new(
            'Top CPU consumers',
            datasource='$datasource',
            styles=null,
        ) 
        .addTargets([
            { expr: 'proc.hog.cpu', format: 'metrics_table', legendFormat: '$metric' },
        ])  + { options+: {sortBy: [{desc: true, displayName: 'proc.hog.cpu'}]}}, gridPos={
            x: 0,
            y: 0,
            w: 12,
            h: 8,
        }
    )

    Test the dashboard

    After creating the Jsonnet file and making a first draft of the dashboard, it is time to test the dashboard out on Grafana.

    To test the dashboard, it must first be compiled into JSON. This step requires the Grafonnet library and the Jsonnet compiler. To make Grafonnet available, pull down the Grafonnet library into the same directory as the new Jsonnet file:

    git clone https://github.com/grafana/grafonnet-lib.git

    Then, install the Jsonnet compiler:

    yum install jsonnet

    Run the following to to compile the Jsonnet into JSON:

    jsonnet -J ./grafonnet-lib pcp-vector-top-cpu-consumers.jsonnet -o pcp-vector-top-cpu-consumers.json

    The newly created JSON file can now be imported into Grafana to test out the dashboard. In Grafana, when creating a new dashboard, it provides the option to Import dashboard. Choose that option and then upload the JSON file and click Import to create the dashboard in Grafana.

    For this dashboard to work, the PCP Vector datasource must be set up with authentication because the proc metrics (proc.hog.cpu) require authentication. You can find the steps for setting up authentication in the grafana-pcp docs: Authentication — grafana-pcp 5.1.2 documentation

    Get the dashboard into grafana-pcp

    To include the dashboard with the PCP Vector datasource, the new dashboard must be added to the PCP Vector datasource's plugin.json. In src/datasources/vector/plugin.json, add the following block:

            {
                "type": "dashboard",
                "name": "PCP Vector: Top CPU Consumer",
                "path": "dashboards/pcp-vector-top-cpu-consumers.json"
            }

    Once the dashboard is ready to be shared, you can open a pull request for the grafana-pcp project with the new Jsonnet file and the addition to the datasource’s plugin.json. Follow this link to the grafana-pcp GitHub repository.

    Next steps: Try it yourself

    The example and steps provided in this article serve as a good starting point for new dashboard development. With the vast number of PCP metrics and expansive set of use cases, grafana-pcp users are in a strong position to develop dashboards that could benefit both themselves and the grafana-pcp community.

    Last updated: December 10, 2025

    Related Posts

    • Generate automated Grafana metrics dashboards for MicroProfile apps

    • Monitor Ansible Automation Platform using Prometheus, Node Exporter, and Grafana

    • How to deploy the new Grafana Tempo operator on OpenShift

    • Monitor an Ansible Automation Platform database using Prometheus and Grafana

    Recent Posts

    • Debugging image mode with Red Hat OpenShift 4.20: A practical guide

    • EvalHub: Because "looks good to me" isn't a benchmark

    • SQL Server HA on RHEL: Meet Pacemaker HA Agent v2 (tech preview)

    • Deploy with confidence: Continuous integration and continuous delivery for agentic AI

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    What’s up next?

    This cheat sheet covers the basics of installing .NET on Red Hat Enterprise Linux (RHEL), how to get a simple program running, and how to run a program in a Linux container.

    Get the cheat sheet
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.