Nagios Exchange Nagios Exchange
  • Home
  • Directory
  • Library
  • Support
  • About
  • Submit Feedback

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up

Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More

  • Home
  • Directory
  • Library
  • Support
  • About
  • Submit Feedback
Plugins4406Themes and Skins13Add-ons760Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Clustering and High-Availability check_elasticsearch_cluster_stats.pl (Advanced Nagios Plugins Collection)
0.0 (0)
7.5K
RSS Feed
Newest Listings Updated Listings
Top Contributors
deskwork_itunes142 (4)Davide Lemma (3)Chad Columbus (3)Marcin Bednarski (3)Andrea Bolongaro (2)
See More
Newest Contributors
pawal (1)matthewducey (1)Linuxfabrik (1)signalgrid (1)Sanna Glue (2)
See More

Copyright © 2009-2026 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home > Stephan Ferraro
SF

Stephan Ferraro

@saf42

User Stats

Member Since: January 7, 2016

Favorites0

Views

Projects0

No Projects Found
check_url

I updated the script to be able to run in parallel with multiple processes

Added PID number for temporary files, that the script can run in parallel with multiple processes. Added a check if one arguments is defined at script startup. Note: The script requires wget to be installed at /usr/bin/. So I updated the source code, here is my version: #!/usr/bin/perl # (C) Unknown author at http://localhost/directory/Plugins/Websites%2C-Forms-and-Transactions/check_url/details # # Changes: # 2016-01-07: Stephan Ferraro # Added PID number for temporary files, that the script can run in parallel with multiple processes. # Added a check if one arguments is defined at script startup. -- Stephan Ferraro use strict; if ($#ARGV == -1) { print STDERR "usage: check_url.pl URLn"; exit 1; } my $wget = '/usr/bin/wget --output-document=/tmp/tmp_'.$$.'.html --no-check-certificate -S'; my ($url) = @ARGV; my @OK = ("200"); my @WARN = ("400", "401", "403", "404", "408"); my @CRITICAL = ("500", "501", "502", "503", "504"); my $TIMEOUT = 20; my %ERRORS = ('UNKNOWN' , '-1', 'OK' , '0', 'WARNING', '1', 'CRITICAL', '2'); my $state = "UNKNOWN"; my $answer = ""; $SIG{'ALRM'} = sub { print ("ERROR: check_url Time-Out $TIMEOUT s n"); exit $ERRORS{"UNKNOWN"}; }; alarm($TIMEOUT); system ("$wget $url 2>/tmp/tmp_".$$.".res1"); if (! open STAT1, "/tmp/tmp_".$$.".res1") { print ("$state: $wget returns no result!"); exit $ERRORS{$state}; } close STAT1; `cat /tmp/tmp_$$.res1|grep 'HTTP/1'|tail -n 1 >/tmp/tmp_$$.res`; open (STAT, "/tmp/tmp_".$$.".res"); my @lines = ; close STAT; if ($lines[0]=~/HTTP/1.d+ (d+)( .*)/) { my $errcode = $1; my $errmesg = $2; $answer = $answer . "$errcode $errmesg"; if ('1' eq &chkerrwarn($errcode) ) { $state = 'WARNING'; } elsif ('2' eq &chkerrcritical($errcode)) { $state = 'CRITICAL'; } elsif ('0' eq &chkerrok($errcode)) { $state = 'OK'; } } sub chkerrcritical { my $err = $1; foreach (@CRITICAL){ if ($_ eq $err) { return 2; } } return -1; } sub chkerrwarn { my $err = $1; foreach (@WARN){ if ($_ eq $err) { return 1; } } return -1; } sub chkerrok { my $err = $1; foreach (@OK){ if ($_ eq $err) { return 0; } } return -1; } `rm /tmp/tmp_$$.html /tmp/tmp_$$.res /tmp/tmp_$$.res1`; print ("$state: $answern"); exit $ERRORS{$state};

Reviewed 11 years ago

No Favorites Found

Copyright © 2009-2026 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home Browse Submit Profile