Thread IIS überwachen (9 answers)
Opened by jan99 at 2015-03-04 08:57

GwenDragon
 2015-03-04 11:18
#179958 #179958
User since
2005-01-17
14757 Artikel
Admin1
[Homepage]
user image
Code (perl): (dl )
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
use strict;
use warnings;
use LWP;
use HTTP::Request;

my $DEBUG  = 1;
my $domain = 'www.iis.net';

my $ua = LWP::UserAgent->new;
$ua->agent(
    'Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko'
);
my $request  = HTTP::Request->new( 'HEAD', "http://$domain/" );
my $response = $ua->request($request);
my $server   = $response->header('Server') // '';
print 'IIS is ', $server =~ /IIS/i ? 'Running' : 'Offline';

$DEBUG
  and print <<TXT,

  
=================== DEBUG!!!! =====================
TXT
  $response->as_string, <<TXT;
=================== DEBUG!!!! =====================
TXT


//EDIT: Code extra Variable für HTTP-Server-Header; echte Testdomain mit IIS; Debugmodus
Last edited: 2015-03-04 11:37:20 +0100 (CET)

View full thread IIS überwachen