--- /dev/null
+#!/usr/bin/perl -w
+# ----------------------------------------------------------------------------
+# File Name: my_check_proc_status.pl
+# Author: Sergey Yurevich
+# Date: 16/01/2007
+# Version: 0.1
+# Description: script checks the status of the process (alive/dead)
+# ----------------------------------------------------------------------------
+
+use strict;
+use warnings;
+use IO::Socket;
+use lib '/usr/local/icinga/libexec/';
+use utils qw($TIMEOUT %ERRORS &print_revision &support);
+
+@ARGV == 5 or die "usage: my_check_proc_status.pl host_ip host_port proc_name\n";
+
+my ($remote_host, $remote_port, $proc_name, $temp_warn, $temp_crit) = @ARGV;
+
+#my $remote_host = 'lxhadesdaq.gsi.de';
+#my $remote_port = '60006';
+my $protocol = 'tcp';
+my $state;
+my $answer = "";
+
+my $socket = IO::Socket::INET->new(PeerAddr => $remote_host,
+ PeerPort => $remote_port,
+ Proto => $protocol,
+ Type => SOCK_STREAM)
+ or $answer = "CRITICAL - no response from $proc_name at $remote_host:$remote_port";
+
+if($answer){
+ $state = $ERRORS{'CRITICAL'};
+}
+else{
+ $answer = <$socket>;
+
+ close($socket);
+
+ if($answer =~ /OK/){
+ $state = $ERRORS{'OK'};
+
+ #- Check disk temperatures
+ my @anser_list = split(/,/, $answer);
+ foreach my $line (@anser_list){
+ if( $line =~ /temp:\s+\/dev\/\w{3}\s+(\d+)/ ){
+ if($1 > $temp_warn && $1 < $temp_crit){
+ $state = $ERRORS{'WARNING'};
+ }
+ elsif($1 > $temp_crit){
+ $state = $ERRORS{'CRITICAL'};
+ }
+ }
+ }
+ }
+ elsif($answer =~ /WARNING/){
+ $state = $ERRORS{'WARNING'};
+ }
+ elsif($answer =~ /CRITICAL/){
+ $state = $ERRORS{'CRITICAL'};
+ }
+ elsif($answer){
+ $state = $ERRORS{'UNKNOWN'};
+ }
+}
+
+if($state == $ERRORS{'OK'}){
+ print "$answer\n";
+}
+elsif($state == $ERRORS{'WARNING'}){
+ print "$answer\n";
+}
+elsif($state == $ERRORS{'CRITICAL'}){
+ print "$answer\n";
+}
+elsif($state == $ERRORS{'UNKNOWN'}){
+ print "UNKNOWN - $answer\n";
+}
+
+exit $state;
+
+
+
+