Skip to content

Instantly share code, notes, and snippets.

View inodes_alert.log
[inodes_alert:log11] 2017/02/28 20:39:40 I! {"Name":"disk","Database":"","RetentionPolicy":"","Group":"host=aws-nv-u-csadb02,path=/net/zfs1/export/analyticsbinning","Dimensions":{"ByName":false,"TagNames":["host","path"]},"Tags":{"host":"aws-nv-u-csadb02","path":"/net/zfs1/export/analyticsbinning"},"Fields":{"inodes_used_percent":0},"Time":"2017-02-28T20:39:40Z"}
[inodes_alert:log11] 2017/02/28 20:39:40 I! {"Name":"disk","Database":"","RetentionPolicy":"","Group":"host=aws-nv-u-csadb02,path=/net/zfs1/export/analyticsdigital","Dimensions":{"ByName":false,"TagNames":["host","path"]},"Tags":{"host":"aws-nv-u-csadb02","path":"/net/zfs1/export/analyticsdigital"},"Fields":{"inodes_used_percent":0},"Time":"2017-02-28T20:39:40Z"}
[inodes_alert:log11] 2017/02/28 20:39:40 I! {"Name":"disk","Database":"","RetentionPolicy":"","Group":"host=aws-nv-u-csadb02,path=/net/zfs1/export/analyticsprojects","Dimensions":{"ByName":false,"TagNames":["host","path"]},"Tags":{"host":"aws-nv-u-csadb02","path":"/net/zfs1/export/analyti
bayendor / inodes_alert.tick
Created Feb 28, 2017
Kapacitor alert to warn on inodes percent used
View inodes_alert.tick
// inodes_alert example
// DEFINE: kapacitor define inodes_alert -type stream -tick inodes_alert.tick -dbrp telegraf.ninety_days
// ENABLE: kapacitor enable inodes_alert
// Parameters
var period = 5m
var every = 30s
var warn = 90
var crit = 95

Keybase proof

I hereby claim:

  • I am bayendor on github.
  • I am dbayendor ( on keybase.
  • I have a public key ASB1V69Is1m_YenJTKqCUfMSmusHP5quka8emz0F5BjJNQo

To claim this, I am signing this object:

bayendor / puppet.vim
Created Apr 4, 2016
VIM Config settings for working with Puppet
View puppet.vim
" Set up puppet manifest and spec options
au BufRead,BufNewfile *.pp
\ set filetype=puppet
au BufRead,BufNewfile *_spec.rb
\ nmap <F8 :!rspec --color %<CR>
" Enable indentation matching for =>'s
filetype plugin indent on
" turn off auto adding comments on next line
bayendor / gist:7999530
Created Dec 17, 2013
Always use :inverse_of to connect two models in a belongs_to/has_many relationship. When you have two models in a belongs_to/has_many relationship, you should always use the :inverse_of option to tell ActiveRecord that they're two sides of the same association. By setting this option, Rails can optimize object loading so forum and forum.posts[0]…
View gist:7999530
class Forum < ActiveRecord::Base
has_many :posts, :inverse_of => :forum
class Post < ActiveRecord::Base
belongs_to :forum, :inverse_of => :posts
bayendor / gist:7385660
Created Nov 9, 2013
Ransack multiple selects
View gist:7385660
f.collection_select :some_id_in, Model.all, :id, :name, {}, {:multiple => true}
# I have to do the following to get the select field I want:
search_form_for @search do |f|
f.collection_select :level_in, Log.levels, :to_s, :to_s, {}, { size: Log.levels.length, multiple: true }
bayendor / gist:7385546
Last active Dec 27, 2015
Checkbox in ransack search
View gist:7385546
# model CLINIC has many TREATMENTS
<%= check_box_tag "q[treatments_id_eq_ALL][]",, {} %>
= f.input :category_name_eq, :collection=>, :as=>:check_boxes
bayendor / gist:7380393
Created Nov 9, 2013
Csv import model logic
View gist:7380393
# controller
def proc_csv
import = Import.find(params[:id])
if import.load_csv
flash[:notice] = "woo"
redirect_to some_url
flash[:error] = "ohoh"
bayendor / sql_limit_return.erb
Last active Dec 25, 2015
Code to display the SQL query from an ActiveRecord Search & to limit number of results returned. From the ransack gem demo.
View sql_limit_return.erb
<p>SQL: <%= @users.to_sql %></p>
<h2>Your first #{search_limit} results</h2>
<th><%= sort_link @search, :id, {}, :method => action_name == 'advanced_search' ? :post : :get %></th>
<th><%= sort_link @search, :first_name, {}, :method => action_name == 'advanced_search' ? :post : :get %></th>
# ...
bayendor / docker
Last active Oct 6, 2015 — forked from chernjie/logrotate.d-docker
Logrotate docker logs, copy this file to /etc/logrotate.d/docker
View docker
/data/docker/containers/*/*-json.log {
rotate 7
size 100M