Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_fastcgi.pl

Current Version
0.1
Last Release Date
2009-09-30
Compatible With
  • Nagios 3.x
Hits
96952
Files:
FileDescription
check_fastcgi.plcheck_fastcgi.pl
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
check_fastcgi.pl is a nagios plugin created for checking the availability and status of a php-cgi FastCGI server.
check_fastcgi.pl is a plugin created for checking the availability of a php-cgi FastCGI server operating with TCP in a local or remote host. You can try it with some other FastCGI application server, it should work. The plugin is writen in Perl and needs the following modules, which can be installed from CPAN ("perl -MCPAN -e shell" is my favorite way to do this):

FCGI::Client
IO::Socket::INET
Getopt::Long

The script takes the following parameters:

my $host = ''; # server host
my $port = 9999; # tcp port
my $script = ''; # test script (absolute path starting at / - root directory -)
my $query_string = ''; # query string
my $expected = 'OK'; # expected string
my $timeout = 5; # timeout in seconds

You'll need to write a script which you'll need to place somewhere in the filesystem of the computer where the FastCGI server is running on. For example, create a test.php file with this inside:

print "OK";
?>

and place it in /var/www/test.php. Then, the "script" parameter should be "/var/www/test.php" and the "expected" parameter should be "OK" (which is the default). The command line for a server on TCP port 9999 on localhost would be then:

check_fastcgi.pl -H 127.0.0.1 -p 9999 -s /var/www/test.php -e OK

Notice that connecting to a php-cgi server (with check_tcp, for example), is not always a sign of a healthy php-cgi, so the execution of a script is necessary to confirm that everything is ok with the server. php-cgi tends to freeze and stay listening to connections but returning end of file >:-/

This plugin is released under the terms of the GNU GPL version 3 (you can find it here: http://www.gnu.org/licenses/gpl-3.0.txt )