Skip to content

Instantly share code, notes, and snippets.

@tzz
tzz / prometheus.yml
Created March 19, 2019 21:39
Barebones Jinja template for Prometheus configuration
# my global config
global:
scrape_interval: 1m # Set the scrape interval
evaluation_interval: 1m # Evaluate rules every N
# scrape_timeout is set to the global default (10s).
external_labels:
monitoring_server: {{ host }}
# Alertmanager configuration
alerting:
@tzz
tzz / chef2prometheus.jq
Created March 19, 2019 21:37
Chef inventory to Prometheus conversion example
#!/usr/bin/jq -Sf
def chef_fields:
# special field adjustments go here
.
;
.rows|
map(select(.name)) | sort_by(.name) |
@tzz
tzz / prometheus-inventory.json
Created March 19, 2019 21:36
Sample Prometheus inventory: node-exporter target
[
{
"labels": {
"kernel_release": "3.4.5.x86_64",
"os": "linux",
"os_version": "3.4.5.x86_64",
"platform": "centos",
"platform_family": "rhel",
"platform_version": "7.8.9"
},
@tzz
tzz / example.md
Created July 20, 2016 18:34 — forked from ericclemmons/example.md
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 <summary>Summary Goes Here</summary>
@tzz
tzz / set
Created April 19, 2016 00:15
(defun save-all-buffers ()
"Unconditionally save all modified buffers."
(interactive)
(save-some-buffers 1)
(message "All buffers saved"))
(add-hook 'focus-out-hook 'save-all-buffers)
@tzz
tzz / test_container_iteration2.cf
Created November 14, 2015 12:05
Test CFEngine container iteration
body common control
{
bundlesequence => { "test" };
}
bundle agent test
{
vars:
"users" data => parsejson('
[
@tzz
tzz / gist:e7829d0ea6e52a2daec9
Last active October 20, 2015 15:26
mapdata() example with CFEngine
bundle agent main
{
methods:
"test";
vars:
"test_state" data => bundlestate(test);
"test_string" string => storejson(test_state);
reports:
bundle agent main
{
methods:
"" usebundle => basic_classes_vars;
"" usebundle => basic_classes("ubuntu-server");
# "" usebundle => basic_classes("fellini");
reports:
server::
"The server class is set";
bundle agent main
{
methods:
"" usebundle => servers;
"" usebundle => serverp("ubuntu-server");
"" usebundle => serverp("fellini");
}
bundle common servers
{
body common control
{
bundlesequence => { holder, test_monit_mustache("ssh") };
}
bundle common holder
{
classes:
"holderclass" expression => "any"; # will be global