Skip to content

Instantly share code, notes, and snippets.

View ncracker's full-sized avatar

Boyan Syarov ncracker

View GitHub Profile
@gphat
gphat / gist:c9d22e1c0d3e0d2546d1
Created August 15, 2014 21:50
Cassandra Datadog JMX Config
instances:
- host: localhost
port: 7199
# user: username
# password: password
# name: cassandra_instance
# #trust_store_path: /path/to/trustStore.jks # Optional, should be set if ssl is enabled
# #trust_store_password: password
# #java_bin_path: /path/to/java #Optional, should be set if the agent cannot find your java executable
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# [email protected]
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@hammady
hammady / solr.service
Created January 9, 2017 08:18
systemd service file for Apache SOLR
# put this file in /etc/systemd/system/ as root
# below paths assume solr installed in /opt/solr, SOLR_PID_DIR is /data
# and that all configuration exists in /etc/default/solr.in.sh which is the case if previously installed as an init.d service
# change port in pid file if differs
# note that it is configured to auto restart solr if it fails (Restart=on-faliure) and that's the motivation indeed :)
# to switch from systemv (init.d) to systemd, do the following after creating this file:
# sudo systemctl daemon-reload
# sudo service solr stop # if already running
# sudo systemctl enable solr
# systemctl start solr
@johnaxel
johnaxel / example-lambda.py
Last active November 18, 2019 14:57 — forked from vagelim/example-lambda.py
Example Lambda to illustrate concepts in lambda blog post
import hashlib
import boto3
import time
## CONFIG ##
BUCKET = 'bucket-name'
FILEPATH = 'hashes'
SEP = '\t'
def log(metric_name, metric_type='count', metric_value=1, tags=[]):
@burnsie7
burnsie7 / log_access.md
Last active January 2, 2025 20:04
Granting access to logs for dd-agent (linux)

The datadog agent runs under the dd-agent user and dd-agent group. This prevents dd-agent accessing the logs in /var/log as they are only accessible by root (or a sudo admin).

In order to allow read only access for dd-agent only, create ACL's and modify logrotate to persist the permissions changes.

You can manually set the ACL with:

sudo setfacl -m g:dd-agent:rx /var/log/<application-name>

This will not persist as logrotate will not re-apply the ACL setting so for a more permanent solution you can add a rule to logrotate to reset the ACL. You will need to create a new file:

@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
@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: [""]
@burnsie7
burnsie7 / multi_org_hosts_count.py
Created July 29, 2018 21:35
multi_org_hosts_count.py
import datetime
import time
import requests
import simplejson
from datadog import initialize, api
"""
This script gives a real time report on ec2 and Datadog agent host usage
from multiple organizations and reports them up to the 'main' parent account.
@burnsie7
burnsie7 / ping_test.py
Last active September 19, 2018 19:51
PingCheck example
from checks import AgentCheck
import os
'''
This is for demostration purposes only and not recommended for production use.
Because of the nature of ping, it could result in a very long running check if there are excessive timeouts.
Long running checks could potentially result in other metrics and checks being skipped.
Example conf.yaml:
@jaycdave88
jaycdave88 / gist:70a85ed2bb185307dea9c467f1b45bba
Last active April 2, 2019 20:28
Windows Ansible script
- hosts: windows
roles:
- { role: Datadog.datadog }
vars:
datadog_api_key: [DATADOG_API_KEY]