This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: DaemonSet | |
metadata: | |
labels: | |
app: metallb | |
component: speaker | |
name: speaker | |
namespace: metallb-system | |
spec: | |
selector: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jmx: | |
per_process_beans: | |
systemStatus: | |
pattern: "Main" | |
beans: | |
- query: "com.sysdig.app:name=SystemStatusExample" | |
attributes: | |
- name: NumberOfSecondsRunning | |
alias: java.app.numberOfSecondsRunning | |
- name: NumberOfUnixSecondsRunning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.management.*; | |
import java.lang.management.ManagementFactory; | |
public class Main { | |
public static void main(String[] args) { | |
try { | |
String programName = (args.length == 0) ? "Java" : args[0]; | |
// Initialize the object | |
SystemStatus systemStatus = new SystemStatus(programName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SystemStatus implements SystemStatusMBean { | |
private Integer numberOfSecondsRunning; | |
private String programName; | |
private Long numberOfUnixSecondsRunning; | |
private Boolean switchStatus; | |
private Thread backgroundThread; | |
public SystemStatus(String programName) { | |
// First we initialize all the metrics | |
this.backgroundThread = new Thread(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface SystemStatusMBean { | |
Integer getNumberOfSecondsRunning(); | |
String getProgramName(); | |
Long getNumberOfUnixSecondsRunning(); | |
Boolean getSwitchStatus(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: go-expvar | |
check_module: go_expvar | |
pattern: | |
comm: go-expvar | |
conf: | |
expvar_url: "http://localhost:8080/debug/vars" # automatically match url using the listening port | |
# Add custom metrics if you want | |
metrics: | |
- path: system.numberOfSeconds | |
type: gauge # gauge or rate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl localhost:8080/debug/vars | |
{ | |
"cmdline": [ | |
"/go-expvar" | |
], | |
"memstats": { | |
"Alloc": 878208, | |
"TotalAlloc": 878208, | |
"Sys": 3084288, | |
"Lookups": 277, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"expvar" | |
"net/http" | |
"time" | |
"os" | |
"io/ioutil" | |
"strings" | |
"strconv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import prometheus_client as prom | |
import random | |
import time | |
from threading import Thread | |
from flask import Flask, request | |
from flask_prometheus import monitor | |
req_summary = prom.Summary('python_my_req_example', 'Time spent processing a request') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sun.net.httpserver.HttpExchange; | |
import com.sun.net.httpserver.HttpHandler; | |
import com.sun.net.httpserver.HttpServer; | |
import io.prometheus.client.*; | |
import io.prometheus.client.exporter.HTTPServer; | |
import io.prometheus.client.hotspot.DefaultExports; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; |
NewerOlder