How to rename label within a metric in Prometheus

you can use the label_replace function in promQL, but it also add the label, don’t replace it label_replace( <vector_expr>, “<desired_label>”, “$1”, “<existing_label>”, “(.+)” ) label_replace( node_systemd_unit_state{instance=”server-01″,job=”node-exporters”,name=”kubelet.service”,state=”active”}, “unit_name”,”$1″,”name”, “(.+)” ) So, to avoid the repetition you can add: sum(label_replace( node_systemd_unit_state{instance=”server-01″,job=”node-exporters”,name=”kubelet.service”,state=”active”}, “unit_name”,”$1″,”name”, “(.+)” ) )by(unit_name)

Why there are both counters and gauges in Prometheus if gauges can act as counters?

From a conceptual point of view, gauge and counter have different purposes a gauge typically represent a state, usually with the purpose of detecting saturation. the absolute value of a counter is not really meaningful, the real purpose is rather to compute an evolution (usually a utilization) with functions like irate/rate(), increase() … Those evolution … Read more

Increasing Prometheus storage retention

Edit the prometheus.service file vi /etc/systemd/system/prometheus.service add “–storage.tsdb.retention.time=1y” below to “ExecStart=/usr/local/bin/prometheus \” line. So the config will look like bellow for 1 year of data retention. [Unit] Description=Prometheus Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple ExecStart=/usr/local/bin/prometheus \ –config.file /etc/prometheus/prometheus.yml \ –storage.tsdb.path /var/lib/prometheus/ \ –web.console.templates=/etc/prometheus/consoles \ –web.console.libraries=/etc/prometheus/console_libraries \ –web.external-url=http://34.89.26.156:9090 \ –storage.tsdb.retention.time=1y [Install] WantedBy=multi-user.target

Monitor the Graphics card usage [closed]

If you develop in Visual Studio 2013 and 2015 versions, you can use their GPU Usage tool: GPU Usage Tool in Visual Studio (video) https://www.youtube.com/watch?v=Gjc5bPXGkTE GPU Usage Visual Studio 2015 https://msdn.microsoft.com/en-us/library/mt126195.aspx GPU Usage tool in Visual Studio 2013 Update 4 CTP1 (blog) http://blogs.msdn.com/b/vcblog/archive/2014/09/05/gpu-usage-tool-in-visual-studio-2013-update-4-ctp1.aspx GPU Usage for DirectX in Visual Studio (blog) http://blogs.msdn.com/b/ianhu/archive/2014/12/16/gpu-usage-for-directx-in-visual-studio.aspx Screenshot from MSDN: … Read more

How can I ‘join’ two metrics in a Prometheus query?

You can use the argument list of group_left to include extra labels from the right operand (parentheses and indents for clarity): ( max(consul_health_service_status{status=”critical”}) by (service_name,status,node) == 1 ) + on(service_name,node) group_left(env) ( 0 * consul_service_tags ) The important part here is the operation + on(service_name,node) group_left(env): the + is “abused” as a join operator (fine … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)