私はRubyが新しく、zabbixモニタなどにいくつかのサーバを追加するスクリプトを再構築しようとしています。私が直面している問題は以下の通りです。スクリプト内でローカル変数またはメソッドを定義する
zbx = ZabbixApi.connect(
:url => 'http://zabbixserver.net/zabbix/api_jsonrpc.php',
:user => 'admin',
:password => 'admin'
)
def createtemplate
zbx.templates.create(
:host => "RealDoc MS Template",
:groups => [:groupid => zbx.hostgroups.get_id(:name => "RealDoc")]
) ..../will create Items, graphs etc...
end
if templateid.empty?
createtemplate
else
puts "Template Exists"
end
それは次のエラースローだcreatetemplateメソッドにアクセスしている:それはないとして、
「@ zbx」で試してください –