Skip to content

Instantly share code, notes, and snippets.

@b4ldr
Last active August 29, 2015 13:57
Show Gist options
  • Save b4ldr/9915759 to your computer and use it in GitHub Desktop.
Save b4ldr/9915759 to your computer and use it in GitHub Desktop.
root@zabbix:~# /usr/local/bin/zabbix_host.py -t 10105 -g 8,2 --exists dev1.example.org
root@zabbix:~# /usr/local/bin/zabbix_host.py -t 10105 -g 8,2 dev1.example.org
root@zabbix:~# /usr/local/bin/zabbix_host.py -t 10105 -g 8,2 --exists dev1.example.org
[{u'hostid': u'10454'}]
See it executes fine
Debug: Executing '/usr/local/bin/zabbix_host.py -t 10105 -g 8,2 --exists dev1.example.org'
and if there is no host it returns an empty string but i never see it run
'/usr/local/bin/zabbix_host.py -t 10105 -g 8,2 dev1.example.org'
{
@@zabbix_host {
$::fqdn:
ensure => present,
groupids => '8,2',
templateids => '10105',
}
Zabbix_host <<| |>>
}
Puppet::Type.type(:zabbix_host).provide(:zabbix) do
commands :zabbix_host => '/usr/local/bin/zabbix_host.py'
defaultfor :kernel => 'Linux'
def create
zabbix_host('-t',@resource[:templateids], '-g', @resource[:groupids], @resource[:name])
end
def destroy
end
def exists?
not zabbix_host('-t',@resource[:templateids], '-g', @resource[:groupids],
'--exists', @resource[:name]).empty?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment