Advertisement
Guest User

Untitled

a guest
Nov 29th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3. use strict;
  4. use warnings;
  5. use Zabbix::Tiny;
  6. use Data::Dumper;
  7.  
  8. # Import config file
  9. require '/home/cnc-admin/zabbix/API/config.pl';
  10.  
  11. # Pull variables from config file
  12. my $url = config_url();
  13. my $password = config_password();
  14. my $username = config_username();
  15.  
  16. # Connect o zabbix server
  17. my $zabbix = Zabbix::Tiny->new(
  18. server => $url,
  19. password => $password,
  20. user => $username
  21. );
  22.  
  23. # API request
  24. my $info = $zabbix->do(
  25. 'configuration.import', # First argument is the Zabbix API method
  26. {
  27. source => $ARGV[0],
  28. format => "json",
  29. rules => {
  30. templates => {
  31. createMissing => "true",
  32. updateExisting => "true",
  33. }
  34. }
  35. }
  36. );
  37.  
  38. # Print the requested information
  39. print Dumper $info
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement