Skip to content

Instantly share code, notes, and snippets.

{%- macro passive_check(state, service) -%}
{%- set state_checks = salt['monitoring.discover_checks_passive'](state) -%}
{%- for host in pillar['shinken_pollers'] -%}
*/{{ state_checks[service]['passive_interval'] }} * * * * nagios output=$({{ state_checks[service]['check_command'] }}); return_code=$?; printf "%s\t%s\t%s\t%s\n" "{{ grains['id'] }}" "{{ service }}" "$return_code" "$output" | /usr/local/nagios/bin/py_send_nsca -H {{ host }} -c /etc/send_nsca.conf
{%- endfor -%}
{%- endmacro %}
@quantonganh
quantonganh / salt.utils.compare_dicts.md
Last active January 1, 2016 14:49
brew module - AttributeError: 'module' object has no attribute 'compare_dicts'

salt --versions-report:

           Salt: 0.17.2
         Python: 2.7.6 (default, Nov 19 2013, 02:02:54)
         Jinja2: 2.7.1
       M2Crypto: 0.21.1
 msgpack-python: 0.4.0
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
@quantonganh
quantonganh / gem list --local
Created December 20, 2013 08:44
openssl.bundle: [BUG] Segmentation fault
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/openssl.bundle: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
the more detail of.
include:
- graphite.common
- logrotate
- pip
- python.dev
/etc/logrotate.d/carbon:
file:
- managed
- template: jinja
@quantonganh
quantonganh / salt '*' state.sls carbon
Created December 13, 2013 18:07
Salt - TypeError: argument of type 'StrictUndefined' is not iterable
Data failed to compile:
----------
Rendering SLS carbon failed, render error: Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/salt/utils/templates.py", line 79, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/usr/lib/pymodules/python2.7/salt/utils/templates.py", line 157, in render_jinja_tmpl
output = jinja_env.from_string(tmplstr).render(**unicode_context)
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "<template>", line 61, in top-level template code
MacBook-Pro.local:
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb:853:in `expand_path': couldn't find HOME environment -- expanding `~/Library/Caches/Homebrew' (ArgumentError)
- from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb:853:in `expand_path'
- from /usr/local/Library/Homebrew/global.rb:25:in `cache'
- from /usr/local/Library/Homebrew/global.rb:44
- from /usr/local/Library/brew.rb:17:in `require'
- from /usr/local/Library/brew.rb:17
{#-
Author: Quan Tong Anh <tonganhquan.net@gmail.com>
Maintainer: Quan Tong Anh <tonganhquan.net@gmail.com>
-#}
{% macro convert_hostname_to_ip(hostname) -%}
{% if salt['dig.A'](hostname) -%}
carbon = {{ salt['dig.A'](hostname)[0] }}:2003
{% else -%}
MacBook-Pro.local:
----------
State: - module
Name: pip.install
Function: run
Result: True
Comment: Module function pip.install executed
Changes: ret: { pid : 69136
retcode : 0
stderr :
MacBook-Pro.local:
----------
State: - module
Name: pip.install
Function: run
Result: True
Comment: Module function pip.install executed
Changes: ret: { pid : 68916
retcode : 0
stderr :
pyopenssl:
module:
- run
- name: pip.install
- pkgs: pyOpenSSL
- bin_env: /usr/local/bin/pip