Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- use Zabbix::Tiny;
- my $hostname = $ARGV[0];
- my $username = 'user';
- my $password = 'goodpassword';
- my $url = 'https://zabbix.domain.com/zabbix/api_jsonrpc.php';
- # Create a new Zabbix::Tiny object
- my $zabbix = Zabbix::Tiny->new(
- server => $url,
- password => $password,
- user => $username,
- );
- my $hosts = $zabbix->do(
- 'host.get',
- output => [qw(hostid name host)],
- filter => {
- host => $hostname,
- }
- );
- for my $host (@$hosts) {
- print "$host->{name} URL: $host->{inventory}->{url_a}\n";
- my $update => {
- 'host.update',
- hostid => $host->{hostid},
- inventory_mode => 1
- };
- }
- exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement