use Net::SSH::Perl; use XML::Simple; do "routines/Log.pm"; my $c_rsync = "$Bin/conf/plugins/rsync.xml"; unless (-e "$c_rsync" ) { Log ( $l_plugin , "no config file was found, exiting" ); exit; } my $xml_conf = eval { XMLin ( $c_rsync , ForceArray => [ 'rsync' ] , KeyAttr => {} , KeepRoot => 0 ) }; if ($@) { Log ( $l_plugin , "failed to load plugin \'rsync\' xml.\nReason: $@" ); exit; } my ( @rFolder , @rUser , @rIp , @rHome , @rProxy ); foreach (@{ $xml_conf -> {'plugin'} -> {'rsync'} }) { push ( @rFolder , $_ -> {'loc'} ); push ( @rUser , $_ -> {'uname'} ); push ( @rIp , $_ -> {'ip'} ); push ( @rHome , $_ -> {'fol'} ); if ( defined ( $_ -> {'proxy'} ) ) { push ( @rProxy , $_ -> {'proxy'} ); } else { push ( @rProxy , 0 ); } } my $cV = 0; foreach ( @rFolder ) { my $rSsh = Net::SSH::Perl -> new ( $rIp[$cV] , protocol => '2,1' , identity_files => [ "/root/rsync/$rUser[$cV]-rsync-key" ] , debug => 1 ); $rSsh -> login ( $rUser[$cV] ); my ( $oMsg , $oErr , $oExit ) = $rSsh -> cmd ( "du" ); print "$oMsg"; $cV++; } exit;