Skip to content

Instantly share code, notes, and snippets.

View danktec's full-sized avatar
🐢

DanK danktec

🐢
View GitHub Profile
@shalk
shalk / gist:7003628
Created October 16, 2013 06:51
virsh console with expect
#!/bin/bash
expect -c "
set timeout 10
spawn virsh console cvm1
expect {
\"Escape character\" {send \"\r\r\" ; exp_continue}
\"Escape character\" {send \"\r\r\" ; exp_continue}
\"login:\" {send \"root\r\"; exp_continue}
\"Password:\" {send \"111111\r\";}
function decToBin(num, acc){
var acc = acc || ""
if (Math.floor(num) == 0) {
console.log(parseInt(acc))
return parseInt(acc)
}
acc = Math.floor(num % 2) + acc
decToBin(num / 2, acc)
}
@thejuan
thejuan / IIS Logstash Grok
Created February 21, 2014 18:16
A Logstash Grok filter for IIS (W3C default fields + bytes sent)
filter{
grok {
match => ["message", "%{TIMESTAMP_ISO8601:log_timestamp} %{WORD:iisSite} %{IPORHOST:site} %{WORD:method} %{URIPATH:page} %{NOTSPACE:querystring} %{NUMBER:port} %{NOTSPACE:username} %{IPORHOST:clienthost} %{NOTSPACE:useragent} %{NOTSPACE:referer} %{NUMBER:response} %{NUMBER:subresponse} %{NUMBER:scstatus} %{NUMBER:bytes:int} %{NUMBER:timetaken:int}"]
}
}
@calebhailey
calebhailey / occurences.md
Last active October 20, 2017 14:27
Preempt sensu-plugin `occurrences` and `refresh` functionality with a simple / lightweight filter

UPDATE (2017-10-20): it has recently been brought to my attention that this gist has been circulated amongst Sensu users as a sort of best practice or "guide". This gist was never meant to be adopted as a long-term solution, but rather an alternative/temporary solution while many changes regarding Sensu event filtering were "in-flight". Many more words regarding changes to event filtering have been captured on the Sensu blog since the writing of this gist: https://blog.sensuapp.org/deprecating-event-filtering-in-sensu-plugin-b60c7c500be3. The TL;DR here is: use the new built-in occurrence filtering that has been available in Sensu Core since version 0.26.0 (release notes).

Hi friends.

There has been a lot of confusion over the past few months about how the Sensu check definition attributes occurrences and refresh actually work. The attributes occurrences and refresh are not (currently) a part of the Sensu [check definitio