Skip to content

Instantly share code, notes, and snippets.

View tembleking's full-sized avatar
🏠
Working from home

Fede Barcelona tembleking

🏠
Working from home
View GitHub Profile
@tembleking
tembleking / config.yaml
Created October 5, 2018 22:44
Golang Expvar Config YAML
- 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
@tembleking
tembleking / SystemStatusMBean.java
Created October 5, 2018 22:47
JMX MBean Interface Example
public interface SystemStatusMBean {
Integer getNumberOfSecondsRunning();
String getProgramName();
Long getNumberOfUnixSecondsRunning();
Boolean getSwitchStatus();
}
@tembleking
tembleking / SystemStatus.java
Created October 5, 2018 22:48
JMX MBean Interface Implementation Example
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();
@tembleking
tembleking / Main.java
Created October 5, 2018 22:53
JMX MBean Main Example
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);
@tembleking
tembleking / config.yaml
Created October 5, 2018 22:54
JMX Sysdig Configuration Example
jmx:
per_process_beans:
systemStatus:
pattern: "Main"
beans:
- query: "com.sysdig.app:name=SystemStatusExample"
attributes:
- name: NumberOfSecondsRunning
alias: java.app.numberOfSecondsRunning
- name: NumberOfUnixSecondsRunning
@tembleking
tembleking / metallb-workload.yaml
Created November 14, 2019 11:13
MetalLB Workload (DaemonSet + Deployment)
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: metallb
component: speaker
name: speaker
namespace: metallb-system
spec:
selector: