Skip to content

Instantly share code, notes, and snippets.

@paha
paha / gist:03c967d82365da731dfa
Last active August 29, 2015 14:15
Passing arguments to salt runner
from reactor:
start_container:
runner.lxc.init:
- host: salt-master
- arg:
- lxc-test
- kwarg:
template: ubuntu
start: true
Custom runner: cs
...
def meta_get(name, node_keys):
log.debug('Requested keys for meta_get: {0}'.format(node_keys))
cs_node = _get_cs_node(name)
if not cs_node:
log.debug('{0} CS node is missing, returning values as "unknown"\
'.format(name))
data = {k: 'unknown' for k in node_keys}
return data
@paha
paha / zbx-script.rb
Created January 24, 2012 19:34
a test script to populate zabbix with groups, templates and hosts
#!/usr/bin/env ruby
#
#
# In this script we'll add each node we have in
require "zbx_api.rb"
require 'chef'
zbx = Lvp::Zbx.new
# lets get the list of groups and templates:
@paha
paha / zbx_api.rb
Created January 24, 2012 19:27
zabbix api library, a start
#!/usr/bin/env ruby
#
# Zabbix library,
# to facilitate interaction with Zabbix API.
# make sure the the apiuser has permittion on the objects you are trying to manipulate, it took me an hour to figure out why my results return empty arrays.
require "net/https"
require "json"
require "resolv"
1 #!/usr/bin/env ruby
2 #
3 # a test for a poll creation, with new members.
4 #
5 require 'rubygems'
6 require 'icontrol'
7
8 # you want this in a yaml or json somewhere
9 IControl.config[:user] = 'blash'
10 IControl.config[:password] = 'balablah'