Skip to content

Instantly share code, notes, and snippets.

@tzz
tzz / prometheus.yml
Created Mar 19, 2019
Barebones Jinja template for Prometheus configuration
View prometheus.yml
# 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 Mar 19, 2019
Chef inventory to Prometheus conversion example
View chef2prometheus.jq
#!/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 Mar 19, 2019
Sample Prometheus inventory: node-exporter target
View prometheus-inventory.json
[
{
"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 Jul 20, 2016 — forked from ericclemmons/example.md
HTML5 <details> in GitHub
View example.md

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>
View set
(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 Nov 14, 2015
Test CFEngine container iteration
View test_container_iteration2.cf
body common control
{
bundlesequence => { "test" };
}
bundle agent test
{
vars:
"users" data => parsejson('
[
@tzz
tzz / gist:e7829d0ea6e52a2daec9
Last active Oct 20, 2015
mapdata() example with CFEngine
View gist:e7829d0ea6e52a2daec9
bundle agent main
{
methods:
"test";
vars:
"test_state" data => bundlestate(test);
"test_string" string => storejson(test_state);
reports:
View gist:d1f43436e79748acd3e6
bundle agent main
{
methods:
"" usebundle => basic_classes_vars;
"" usebundle => basic_classes("ubuntu-server");
# "" usebundle => basic_classes("fellini");
reports:
server::
"The server class is set";
View gist:5d33615a07243bf6448e
bundle agent main
{
methods:
"" usebundle => servers;
"" usebundle => serverp("ubuntu-server");
"" usebundle => serverp("fellini");
}
bundle common servers
{
View gist:bf05e2805fdaea6d466b
body common control
{
bundlesequence => { holder, test_monit_mustache("ssh") };
}
bundle common holder
{
classes:
"holderclass" expression => "any"; # will be global