Skip to content

Instantly share code, notes, and snippets.

@DD-ScottBeamish
DD-ScottBeamish / remoteSSH.py
Created August 19, 2020 13:54
Custom Action - Remote SSH
import time,paramiko
from checks import AgentCheck
class remoteSSHCheck(AgentCheck):
def check(self, instance):
client = paramiko.SSHClient()
#client.load_system_host_keys()
#client.connect(instance['host'])
@DD-ScottBeamish
DD-ScottBeamish / bigdog.iot.go
Created May 6, 2020 15:21
IoT Software Version Demo
package main
import (
"time"
"fmt"
"strconv"
"net/http"
"math"
"math/rand"
"io/ioutil"
@DD-ScottBeamish
DD-ScottBeamish / GetProcessByUser.py
Last active February 9, 2021 21:59
Windows - Get process CPU, Private Memory, and Virtual Memory for each user
from checks import AgentCheck
from datadog_checks.utils.subprocess_output import get_subprocess_output
class GetProcessByUser(AgentCheck):
def check(self, instance):
processes, err, retcode = get_subprocess_output(["powershell.exe", "Get-Process -IncludeUserName | where {$_.Username -notlike \"*NT AUTHORITY*\"} | where {$_.Username -notlike \"*SYSTEM*\"} | where {$_.Username -ne $null} | where {$_.Username -notlike \"*Window Manager*\"} | Select ProcessName,Username,CPU,PM,VM"], self.log, raise_on_empty_output=True)
# ProcessName : Code
# UserName : WIN-5OU1M45KDAQ\vagrant
# CPU : 14.28125
kind: ConfigMap
apiVersion: v1
metadata:
name: dd-agent-config
namespace: myproject
data:
kubernetes.yaml: |-
init_config:
min_collection_interval: 300
instances:
@DD-ScottBeamish
DD-ScottBeamish / dd-agent.yaml
Created July 17, 2018 16:02
k8s 1.10 + RBAC + TLS_VERIFY=false
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: datadog-agent
spec:
template:
metadata:
labels:
app: datadog-agent
name: datadog-agent
@DD-ScottBeamish
DD-ScottBeamish / config-map.yaml
Created April 4, 2018 13:51
K8S 1.9 + Auto Discovery
kind: ConfigMap
apiVersion: v1
metadata:
name: datadog-config
namespace: default
data:
tomcat-autoconf.yaml: |-
ad_identifiers:
- tomcat
@DD-ScottBeamish
DD-ScottBeamish / dd-agent.yaml.selector.sa
Created March 7, 2018 18:20
OpenShift 3.3 using Privileged Pod
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: dd-agent
spec:
selector:
matchLabels:
name: dd-agent
template:
metadata:
@DD-ScottBeamish
DD-ScottBeamish / datadog-agent-daemonset.yaml
Last active March 9, 2018 18:14
K8S + RBAC + AutoDisco + ConfigMap + Separate Namespaces
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: datadog-agent
spec:
selector:
matchLabels:
name: datadog-agent
template:
metadata:
@DD-ScottBeamish
DD-ScottBeamish / cluster-role.yaml
Last active June 18, 2018 17:49
OpenShift 3.6 Development Environment w/RBAC
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: datadog
rules:
- nonResourceURLs:
- "/version" # Used to get apiserver version metadata
- "/healthz" # Healthcheck
verbs: ["get"]
- apiGroups: [""]
@DD-ScottBeamish
DD-ScottBeamish / config-map.yaml
Last active March 2, 2018 21:35
Setting up an OpenShift Development Environment Using MiniShift (Unrestricted)
kind: ConfigMap
apiVersion: v1
metadata:
name: dd-agent-config
namespace: myproject
data:
kubernetes: |-
init_config:
instances:
port: 4194