Leser: 2
![]() |
|< 1 2 >| | ![]() |
17 Einträge, 2 Seiten |
1 2 3 4
my $plink_dir = "C:\Programme\Putty"; my $res_query = "df -Ph"; my $erg = plink.exe -ssh -P 22 -pw $PW $USER@$FQDN $res_query;
plink -ssh -pw geheim user@123.45.56.7 df -Ph /Pfad
my $erg = plink.exe -ssh -P 22 -pw $PW $USER@$FQDN $res_query;
my $erg = `plink.exe -ssh -P 22 -pw $PW $USER@$FQDN $res_query`;
1
2
3
4
5
6
7
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 2.4G 2.0G 329M 86% /
tmpfs 756M 0 756M 0% /lib/init/rw
udev 10M 68K 10M 1% /dev
tmpfs 756M 8.0K 756M 1% /dev/shm
/dev/sda5 10G 9.3G 758M 93% /home
1
2
3
4
df -Ph -x tmpfs
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 2.4G 2.0G 329M 86% /
/dev/sda5 10G 9.3G 758M 93% /home
$plink_dir = 'C:\Program Files\PuTTY';
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
#!/usr/bin/perl use strict; use IO::File; use Win32; use Win32::AdminMisc; use Win32::OLE qw (in); # Ordner, in dem die CSV-Datei liegt my $dir = '.'; # Trennzeichen in der Datei my $sep = ';'; # Datei oeffnen open(DATEN,'<D:\reporting_script\systems.txt') or die "Konnte die Datei nicht öffnen"; # Inhalte abgreifen und splitten while (defined(my $zeile = DATEN->getline)) { my ($FQDN, $OS, $HDD, $USER, $PW) = split(/;/,$zeile); # Abfrage der WindowsHosts if($OS eq 'win') { # Verbindungsaufbau my $conn_object = Win32::OLE->new('WbemScripting.SWbemLocator'); my $server = $conn_object->ConnectServer($FQDN, "root\\cimv2", $USER, $PW); # Abfrage des Datentraeger my $total; my $free; ($total, $free) = Win32::AdminMisc::GetDriveSpace("$HDD:\\"); $total = $total / 1024 /1024; # MegaByte! $free = $free / 1024 /1024; # MegaByte! printf ("\n"); printf ("Speicher gesamt: $total MB\n"); printf ("Speicher verfuegbar: $free MB\n"); printf ("\n"); printf (""); } # Abfrage LinuxHosts if($OS eq 'lin') { # Verbindungsaufbau my $plink_dir = "D:\\reporting_script"; my $res_query = "df -Ph"; my $erg = qx{"$plink_dir\\plink.exe" -ssh -P 22 -pw $PW $USER\@$FQDN $res_query}; printf ("$erg"); } }close(DATEN); printf ("\n"); printf("schleife tot...");
zottel335i+2008-07-16 10:43:52--Code (perl): (dl )1 2 3 4 5 6 7 8 9[...] # Verbindungsaufbau my $conn_object = Win32::OLE->new('WbemScripting.SWbemLocator'); my $server = $conn_object->ConnectServer($FQDN, "root\\cimv2", $USER, $PW); # Abfrage des Datentraeger my $total; my $free; ($total, $free) = Win32::AdminMisc::GetDriveSpace("$HDD:\\"); [...]
Das Skript fragt jedoch immer nur die Festplatten des lokalen Systems ab.
[...]
![]() |
|< 1 2 >| | ![]() |
17 Einträge, 2 Seiten |