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

How can I view live MySQL queries?

You can log every query to a log file really easily: mysql> SHOW VARIABLES LIKE “general_log%”; +——————+—————————-+ | Variable_name | Value | +——————+—————————-+ | general_log | OFF | | general_log_file | /var/run/mysqld/mysqld.log | +——————+—————————-+ mysql> SET GLOBAL general_log = ‘ON’; Do your queries (on any db). Grep or otherwise examine /var/run/mysqld/mysqld.log Then don’t forget to … Read more

How to activate JMX on my JVM for access with jconsole?

The relevant documentation can be found here: http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html Start your program with following parameters: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.rmi.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false For instance like this: java -Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.port=9010 \ -Dcom.sun.management.jmxremote.local.only=false \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ -jar Notepad.jar -Dcom.sun.management.jmxremote.local.only=false is not necessarily required but without it, it doesn’t work on Ubuntu. The error would be something … Read more