Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To collect metrics from a service in OpenShift, expose Prometheus-formatted data at /metrics, enable user-workload monitoring, and create a ServiceMonitor that selects the Kubernetes Service in the same namespace. Use a PodMonitor instead when you need Prometheus to discover pods directly and there is no Service. The examples below cover endpoints represented by OpenShift workload resources; a remote system with no corresponding Service or pod is a different discovery case.

What OpenShift needs to scrape

The user-workload monitoring stack scrapes a Prometheus-compatible HTTP metrics endpoint. The expected exposition path for custom metrics is /metrics. Before changing OpenShift resources, check that the endpoint responds and returns metric data. For example, run curl -i http://metrics.example.internal:8080/metrics using the real host and port for your endpoint. Red Hat’s OpenShift documentation says services must be configured for monitoring to scrape their /metrics endpoint.

A successful response from a workstation does not by itself prove that the monitoring components can reach the endpoint. The endpoint must also be reachable from the cluster monitoring stack, and its transport and authentication requirements must match the scrape configuration. Red Hat’s sample uses HTTP and notes that the sample service does not support TLS; do not copy that transport choice without checking your target.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose ServiceMonitor or PodMonitor

Resource Use it when Discovery target
ServiceMonitor A Kubernetes Service fronts the metrics endpoint. Services selected by labels; the selected Service must expose the named port used in the monitor endpoint.
PodMonitor You want to scrape a pod directly and do not have a Service for it. Pods selected directly.

Red Hat states that a ServiceMonitor requires a Service, whereas a PodMonitor does not. For ordinary applications exposed through a Service, prefer ServiceMonitor: it follows Service selection rather than binding monitoring to individual pod targets. Choose PodMonitor when direct pod discovery is the intended setup. The manifest and namespace example below is specifically for ServiceMonitor.

#1 Best Overall
Feit Electric Smart Wi-Fi Plug - Alexa and Google Home Compatible - 1 Count
  • WIFI ENABLED TO CONTROL FROM ANYWHERE – Transform your home into a smart home with the Feit Electric Smart Wi-Fi Plug. Remotely turn on or off lights, fans, coffee makers, or other home appliances from your smartphone or tablet. Works seamlessly with Alexa and Google Home, giving you effortless voice control without needing a separate hub. Manage your devices anytime, whether you’re at home, at work, or traveling.
  • SIMPLE SETUP, NO HUB REQUIRED – Enjoy the convenience of smart home automation without extra equipment. The plug connects directly to your 2.4 GHz Wi-Fi network, making installation fast and easy. Plug it in, download the Feit Electric app, follow the simple steps, and your devices are instantly connected. Perfect for beginners or anyone looking to expand their smart home ecosystem with minimal hassle.
  • SET YOUR ROUTINE & SAVE ENERGY – Save energy, stay organized, and automate daily routines with customizable schedules and timers. Set your lamps, heaters, or appliances to turn on and off automatically at specific times, ensuring your home is always comfortable and efficient. Ideal for morning routines, evening wind-downs, or holiday lighting, giving you peace of mind and energy savings without constant manual operation.
  • ENHANCED SAFETY & CONVENIENCE – Protect your home and appliances with the Feit Electric Smart Plug’s durable design and safety features. Its compact size fits easily into standard indoor outlets without blocking other sockets. With real-time app control and notifications, you can monitor appliance activity and prevent energy waste. Ideal for families, pet owners, or anyone seeking a smarter, safer, and more convenient home setup.
  • RELIABLE 2.4GHz WI-FI PERFORMANCE – Designed to work exclusively on 2.4 GHz networks, this smart plug provides stable connectivity for smooth operation of all your devices. Avoid interruptions caused by incompatible networks, ensuring your appliances respond instantly when controlled via the app or voice commands. Perfect for indoor home use, it supports up to 15 amps, handling heavy-duty appliances safely and reliably.

Enable user-workload monitoring and check access

User-defined projects are not monitored by the user-workload stack until that monitoring is enabled. Have a cluster administrator enable it using the procedure for your OpenShift version. You also need permissions to manage monitoring resources: the documented options include cluster-admin, monitoring-edit, or equivalent administrative access.

Metrics visibility is separately protected by RBAC. Grant only the access needed to create or view monitoring resources and query collected data. Red Hat identifies roles such as cluster-monitoring-view and cluster-monitoring-metrics-api for monitoring access; use the role appropriate to the operation rather than granting broad cluster privileges by default.

Rank #2
Wintertion1U/Desktop/Rackmount Firewall Hardware,OPNsense, VPN, Network Security Appliance, Router PCN2600 D2700, 4 x Gigabit LAN, COM, VGA, Fan, 0 RAM, 0 Storage (Desktop Type, 4G RAM 64G SSD)
  • equipped with atom n2600 d2700 processor, compatible with many freebsd based router systems, linux distros, or win.os supported, easy configuration and management
  • Please note, this is a barebone only. A system memory, a storage drive and an operating system are needed to complete this system
  • 13-19 inches 1u, 50w power, with power cord, make sure to use a big brand memory and ssd/hdd with quality assurance
  • Designed with console, 2 x usb, 4 x lan, vga, power switch, size at 290 x 180 x 44mm
  • There are 2 inside reserved fans on chassis, which could be removed freely or be turned on in a high temperature environment to ensure the best function of the product

Create a ServiceMonitor in the workload namespace

Use the service’s actual selector labels, named port, namespace, and transport scheme. This follows Red Hat’s documented example pattern; its 30s interval is sample configuration, not a required interval.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: prometheus-example-monitor
  namespace: ns1
spec:
  endpoints:
  - interval: 30s
    port: web
    scheme: http
  selector:
    matchLabels:
      app: prometheus-example-app

Here, selector.matchLabels must match labels on the Service, and endpoints.port must name a Service port. Adapt ns1, the labels, port, scheme, and interval to the real workload. If the endpoint requires HTTPS or authentication, configure and verify those settings for the actual service instead of copying the HTTP example.

Rank #3
Shelly Plus 1PM | WiFi Smart Relay Switch with Power Metering | Home Automation | Bluetooth Gateway | Compatible with Alexa & Google Home | No Hub | Wireless Lighting Control (2 Pack)
  • Shelly Plus 1 PM is a Wi-Fi smart relay switch with 1 channel, up to 16A with power metering that can be used also as a WiFi repeater and Bluetooth gateway. Shelly Plus 1PM can be used to monitor the consumption and take control of home appliances, electric circuits, and office equipment individually.
  • Automate electrical appliance and control - With Shelly Plus 1PM you can automate any electrical appliance in your home and control it remotely. Shelly Plus 1PM can control appliances with a large load which makes it perfect for kitchen appliances and domestic systems monitoring and control. You can get precise measurements of the power consumption of each appliance and switch in on/off remotely, no matter where you are.
  • Set and be prepared for everything - Reveal the full potential of Shelly Plus 1PM by combining it with other devices from your home network! Set Shelly Plus 1PM to activate custom scenes based on hour, light, or various occurrences. For example, you can set Shelly Door/Window sensor to report a porch door opening and activate Shelly Plus 1PM to turn on the hot tub heaters only in the hours after 8 pm.
  • Shelly Customer Service - Shelly is one of the fastest-growing Smart Home brands in the world with devices, providing solutions for the automation of private homes, buildings and businesses. We provide our customers with professional support and a 3 years device warranty.
  • Shelly Smart Control App will help you control your Shelly devices remotely and will send notifications for all automated events in your home. You can easily configure devices and manage their settings individually, or you can create personalized scenes by combining Shelly devices to trigger certain actions in your home automation.
  1. Save the resource as a YAML file, for example service-monitor.yaml.
  2. Apply it with oc apply -f service-monitor.yaml.
  3. Confirm it exists in the workload namespace with oc -n ns1 get servicemonitor, replacing ns1 with that namespace.

Understand the namespace boundary

A ServiceMonitor placed in a user-defined namespace discovers Services only in that same namespace. Red Hat specifically notes that namespaceSelector is ignored for a ServiceMonitor in a user-defined namespace. Put the monitor alongside the Service it selects; adding a cross-namespace selector there will not extend discovery.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify collection and troubleshoot missing metrics

  1. Check the endpoint first. Request the real /metrics URL with curl. Confirm that it returns Prometheus-formatted metrics, not an error page, redirect, or authentication challenge.
  2. Confirm user-workload monitoring is enabled. If the workload is in a user-defined project and the feature is off, its metrics will not be collected by that stack.
  3. Check the resource and namespace. Run oc -n <namespace> get servicemonitor and verify the monitor is in the same namespace as its Service. Replace <namespace> with the real namespace when running the command.
  4. Compare labels and port names. The monitor’s selector must match the Service labels, and the configured endpoint port must correspond to a named Service port. A selector that matches no Service, or a port name that does not match, prevents the expected target from being selected.
  5. Check reachability and scrape settings. Verify that the monitoring stack can reach the endpoint and that the configured scheme, TLS, and authentication requirements agree with the service’s configuration.
  6. Query with authorized access. Use the documented Prometheus endpoints or OpenShift monitoring interface with an account granted an appropriate monitoring role. RBAC can prevent access to query results even when scraping is configured.

Do not assume installed operators are scraped automatically

User-installed operators are not automatically scraped by the default monitoring stack. If an operator exposes metrics, configure monitoring for its endpoint explicitly and confirm it is within the scope of user-workload monitoring.

Quick Recap

Rank #4
Dualcomm Raspberry Pi Network TAP Appliance
  • Portable 100M/1G Network TAP Appliance for remote capture of data traffic
  • Integrated with a Raspberry Pi 4 module (8GB RAM and 64GB Micro SD Card)
  • Can be used as a standalone 100M/1G network TAP with the external monitor port
  • Dual DC power inputs for enhancing overall system availability

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.