lunes, 23 de noviembre de 2026

Check queries and queues in redshift

 Check which queue is using the user

SELECT w.service_class,
       COUNT(*)                        AS queries,
       AVG(w.total_queue_time)/1e6     AS avg_queue_s,
       AVG(w.total_exec_time)/1e6      AS avg_exec_s,
       MAX(w.service_class_start_time) AS last_seen
FROM stl_wlm_query w
JOIN pg_user u ON u.usesysid = w.userid
WHERE u.usename = 'REDSHIFTUSER'
  AND w.service_class_start_time > DATEADD(day, -1, GETDATE())
GROUP BY 1
ORDER BY queries DESC;

 

Review queue times along the hour


SELECT DATE_TRUNC('hour', w.service_class_start_time)         AS hr,
       EXTRACT(minute FROM w.service_class_start_time) < 2    AS top_of_hour,
       COUNT(*)                                               AS queries,
       ROUND(AVG(w.total_queue_time::float)/1e6, 2)           AS avg_queue_s,
       ROUND(MAX(w.total_queue_time::float)/1e6, 2)           AS max_queue_s,
       ROUND(AVG(w.total_exec_time::float)/1e6, 2)            AS avg_exec_s,
       ROUND(MAX(w.total_exec_time::float)/1e6, 2)            AS max_exec_s
FROM stl_wlm_query w
JOIN pg_user u ON u.usesysid = w.userid
WHERE u.usename = 'REDSHIFTUSER'
  AND w.service_class = 101
  AND w.service_class_start_time > DATEADD(day, -1, GETDATE())
GROUP BY 1, 2
ORDER BY 1, 2;


Check queries running at certain time with their queues

SELECT u.usename, w.query, w.service_class_start_time, w.service_class_end_time,
                w.total_queue_time/1e6 AS queue_s, w.total_exec_time/1e6 AS exec_s,
                LEFT(q.querytxt, 100) AS sql
         FROM stl_wlm_query w
         JOIN pg_user u ON u.usesysid = w.userid
         LEFT JOIN stl_query q ON q.query = w.query
         WHERE w.service_class = 101
           AND w.service_class_start_time < '2026-11-23 19:01:30'
           AND w.service_class_end_time   > '2026-11-23 18:59:30'
         ORDER BY w.total_exec_time DESC


 Check if the queues have auto wlm
SELECT service_class, name, num_query_tasks, query_working_mem, concurrency_scaling
FROM stv_wlm_service_class_config WHERE service_class >= 100;

 

Check current priorities of queues 

SELECT service_class, TRIM(name) AS name, query_priority
FROM stv_wlm_service_class_config WHERE service_class >= 100; 

 

 

One Media Folder, Many Containers: Sharing Storage Between Jellyfin and qBittorrent on Proxmox

I run Jellyfin in an LXC container on my Proxmox homelab, and I wanted to add a torrent client in its own container. The question was simple: **where should the movies live so both containers can use them?**

My first instinct was to give Jellyfin a bigger disk. That turned out to be the wrong answer. This post covers what I ended up doing instead: a single LVM-thin volume, mounted on the Proxmox host and bind-mounted into every container that needs it.


- Proxmox VE with the default **LVM-thin** storage (`local-lvm`). No ZFS.
- CT 108: Jellyfin (unprivileged LXC, from the community-scripts installer)
- CT 109: qBittorrent (unprivileged LXC, also from community-scripts)

The goal:


Proxmox host
└── /dev/pve/media → mounted at /mnt/media
├──► CT 108 (Jellyfin) /media read-only
└──► CT 109 (qBittorrent) /media read-write

In the Proxmox web UI, **Container → Resources → Add → Mount Point** looks like exactly what you need. But that dialog creates a **new volume** that belongs to that one container


Run this in the Proxmox host shell



lvcreate -V 30G -T pve/data -n media
mkfs.ext4 /dev/pve/media
mkdir -p /mnt/media
echo '/dev/pve/media /mnt/media ext4 defaults,noatime 0 2' >> /etc/fstab
systemctl daemon-reload && mount -a
mkdir -p /mnt/media/{movies,tv,downloads}

# permissions: shared group for unprivileged containers
groupadd -g 110000 media
chown -R 100000:110000 /mnt/media
chmod -R 2775 /mnt/media

# bind mount into Jellyfin
pct set 108 -mp0 /mnt/media,mp=/media,ro=1
pct reboot 108

# bind mount into qbittorrent
pct set 109 -mp0 /mnt/media,mp=/media
pct reboot 109

domingo, 15 de noviembre de 2026

node-exporter on the Proxmox host

 

I run a small homelab: a single-node Kubernetes cluster (MicroK8s) inside a VM on Proxmox, with Prometheus, Loki and Grafana for observability. node-exporter runs as a DaemonSet and gives me CPU, memory, disk and network metrics for the node. One day I went to build a temperature panel in Grafana and found... nothing.

This post explains why, and the simple fix.

The symptom

node-exporter has two collectors for temperatures, both enabled by default:

  • hwmon: reads /sys/class/hwmon/* and exports node_hwmon_temp_celsius. This is where CPU sensors like coretemp (Intel) or k10temp (AMD) show up.
  • thermal_zone: reads /sys/class/thermal/* and exports node_thermal_zone_temp.

Querying the exporter from inside the VM gave me either nothing or a meaningless ACPI zone:

curl -s http://<vm-ip>:9100/metrics | grep -E 'node_hwmon_temp|node_thermal_zone'

Why it happens

A virtual machine doesn't see the physical hardware sensors. The hypervisor gives the guest a virtual CPU, and there is no coretemp or k10temp chip inside it. node-exporter is working correctly; there is simply nothing to read.

My next idea was to get the temperature from Proxmox. It turns out the Proxmox API (and therefore pve-exporter) reports CPU usage per node and per guest, but not temperature. Proxmox doesn't collect hardware sensor data at all.

So the temperature can only come from one place: the Proxmox host itself.

The fix: node-exporter on the Proxmox host

Proxmox is Debian underneath, so this is a few commands:

apt install lm-sensors prometheus-node-exporter
sensors-detect --auto      # loads coretemp (Intel) or k10temp (AMD)
sensors                    # you should now see Package/Core or Tctl temperatures

The Debian package installs node-exporter as a systemd service listening on port 9100. Check that the temperatures are exported:

curl -s localhost:9100/metrics | grep node_hwmon_temp_celsius

Is it OK to install things on the hypervisor?

I hesitated here, because the usual advice is to keep the hypervisor lean. But that advice is aimed at heavy agents and running Docker on the host. node-exporter is a single static binary that only reads from /proc and /sys, and it's the standard way to monitor a Proxmox host. A few details make it a clean install:

  • Use the Debian package, not a binary downloaded by hand. It's an older version, but it gets security updates through apt like the rest of the system.
  • Run it on bare metal, not in an LXC container or VM. Otherwise you're back to the original problem: no sensors.
  • Restrict access to port 9100. node-exporter has no authentication and exposes details like mounts, network interfaces and kernel version. See the next section.

Locking down port 9100

You have two options, and you can combine them.

Option 1: Proxmox firewall. Under Datacenter → (your node) → Firewall, add a rule that accepts TCP 9100 only from your Prometheus server, then drop it for everyone else.

Be careful if the Proxmox firewall isn't enabled yet. Turning it on at the datacenter level with a DROP input policy can lock you out of the web UI and SSH. Check your rules for ports 8006 and 22 before enabling it.

If Prometheus runs inside Kubernetes (as mine does), the traffic usually leaves the cluster with the node's IP, not the pod's, because of SNAT. Check the firewall log after the first scrape to confirm which source IP to allow.

Option 2: bind to the management interface only. Edit /etc/default/prometheus-node-exporter:

ARGS="--web.listen-address=<management-ip>:9100"

Then restart the service:

systemctl restart prometheus-node-exporter

Scraping the host from Prometheus

My Prometheus discovers targets through Kubernetes, so it doesn't know about the Proxmox host. Add a static job to prometheus.yml:

scrape_configs:
  - job_name: proxmox-host
    static_configs:
      - targets: ["<proxmox-host-ip>:9100"]
        labels:
          instance: proxmox

Reload Prometheus and check that the target is UP on the Status → Targets page.

The Grafana panel

node-exporter also exports a node_hwmon_sensor_label metric with the human-readable name of each sensor (such as "Package id 0" or "Core 0"). Joining the two gives readable legends:

node_hwmon_temp_celsius{instance="proxmox"}
  * on (chip, sensor) group_left(label)
  node_hwmon_sensor_label{instance="proxmox"}

Use {{label}} as the legend and set the unit to Celsius. To show just one number (for example in a stat panel), filter for the package sensor: label="Package id 0" on Intel, or label="Tctl" on AMD.

Bonus: Google Coral temperature

If you use a Google Coral TPU (for example with Frigate), note that it doesn't show up in node-exporter either:

  • The PCIe/M.2 Coral driver (gasket/apex) exposes temperature in /sys/class/apex/apex_0/temp (in millidegrees). That isn't a hwmon device, so node-exporter ignores it.
  • The USB Coral has no temperature sensor at all.

For the PCIe version, the textfile collector works well. A small cron job writes a metric file:

#!/bin/sh
# /usr/local/bin/coral-temp.sh, run every minute from cron
DIR=/var/lib/prometheus/node-exporter
T=$(cat /sys/class/apex/apex_0/temp)
echo "coral_temp_celsius $(awk "BEGIN{print $T/1000}")" > "$DIR/coral.prom.$$"
mv "$DIR/coral.prom.$$" "$DIR/coral.prom"

The Debian package already reads .prom files from /var/lib/prometheus/node-exporter. Writing to a temporary file and then renaming it prevents node-exporter from reading a half-written file. Run this wherever the Coral is visible: on the host, or inside the VM if you passed the device through.

If you run Frigate, its /api/stats endpoint also reports the Coral temperature, so a Frigate exporter is another option.

Summary

  • VMs can't see hardware temperature sensors, so node-exporter inside a VM shows no CPU temperature.
  • The Proxmox API doesn't expose temperatures either.
  • Install lm-sensors and prometheus-node-exporter on the Proxmox host, restrict port 9100, and add a static scrape job.
  • Coral temperature needs the textfile collector (or Frigate's stats).

Ten minutes of work, and now I have a temperature panel that actually shows something.