<pre name="code" class="python">#!/usr/bin/perl
use JSON::RPC::Client;
use Data::Dumper;
# Authenticate yourself
if ( $#ARGV < 1 ) {
print "please input your host and ip !\n";
exit(-1);
}
my $client = new JSON::RPC::Client;
my $url = 'http://192.168.32.83/zabbix/api_jsonrpc.php';
my $authID;
my $response;
my $json = {
jsonrpc => "2.0",
method => "user.login",
params => {
user => "admin",
password => "zabbix"
},
id => 1
};
$response = $client->call( $url, $json );
print "-----------------\n";
print $response->content->{result} . "\n";
# Check if response was successful
die "Authentication failed\n" unless $response->content->{'result'};
$authID = $response->content->{'result'};
print "Authent
perl 批量添加zabbix
最新推荐文章于 2019-04-05 14:40:45 发布