Advertisement
Guest User

Untitled

a guest
May 9th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3. use strict;
  4. use warnings;
  5. use Zabbix::Tiny;
  6.  
  7. # Open file with host ids
  8. open ("idfile", "id.txt");
  9. while (my $record = <idfile>) {
  10.  
  11. # Zabbix connection and credentials
  12. my $username = 'hydruid';
  13. my $password = 'YOURMOM';
  14. my $url = 'http://ec2-5.5.5.5.us-west-2.compute.amazonaws.com/api_jsonrpc.php';
  15. my $zabbix = Zabbix::Tiny->new(
  16. server => $url,
  17. password => $password,
  18. user => $username
  19. );
  20.  
  21. # Zabbix api call to get host information
  22. my $hosts = $zabbix->do(
  23. 'host.get', # First argument is the Zabbix API method
  24. {
  25. output => "extend",
  26. filter => { "host" => "PPS_Proxy"},
  27. }
  28. );
  29.  
  30. # Print the host information so it can be captured to a file
  31. print $hosts
  32.  
  33. # Close file with host ids
  34. }
  35. close("idfile");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement