Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use Data::Dumper;
- use Net::SSH::Perl;
- $debug=0;
- $ip="IP OD ROUTERJA DAJ SEM";
- $username="USERNAME DAJ SEM CUJ!";
- $password="PASSWORD DAJ SEM";
- $hostname="HOSTNAME DAJ SEM";
- #=======================================================
- $ENV{HOME} = '/tmp/';
- if ($ARGV[0] && $ARGV[0] eq "config") {
- print "host_name $hostname\n";
- print "graph_args --base 1000 -l 0 -r --lower-limit 0\n";
- print "graph_title DHCP leases\n";
- print "graph_vlabel number\n";
- print "graph_category network\n";
- print "graph_info This graph shows the number of active DHCP leases\n";
- print "graph_scale no\n";
- print "dhcp.label DHCP Leases\n";
- exit;
- }
- $ssh = Net::SSH::Perl->new($ip) or die $!;
- $ssh->login($username, $password) or die $!;
- ($stdout,$stderr,$exitcode) = $ssh->cmd("ip dhcp-server lease print without-paging terse where status=\"bound\"");
- print Dumper($stdout) if $debug;
- $numberofclients = () = $stdout =~ /status=bound/gi;
- print "num: $numberofclients\n" if $debug;
- print "dhcp.value $numberofclients\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement