-
-
Save b4ldr/9915759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
@@zabbix_host { | |
$::fqdn: | |
ensure => present, | |
groupids => '8,2', | |
templateids => '10105', | |
} | |
Zabbix_host <<| |>> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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