Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict;
- use warnings;
- use Zabbix::Tiny;
- # Open file with host ids
- open ("idfile", "id.txt");
- while (my $record = <idfile>) {
- # Zabbix connection and credentials
- my $username = 'hydruid';
- my $password = 'YOURMOM';
- my $url = 'http://ec2-5.5.5.5.us-west-2.compute.amazonaws.com/api_jsonrpc.php';
- my $zabbix = Zabbix::Tiny->new(
- server => $url,
- password => $password,
- user => $username
- );
- # Zabbix api call to get host information
- my $hosts = $zabbix->do(
- 'host.get', # First argument is the Zabbix API method
- {
- output => "extend",
- filter => { "host" => "PPS_Proxy"},
- }
- );
- # Print the host information so it can be captured to a file
- print $hosts
- # Close file with host ids
- }
- close("idfile");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement