Newbee need help! NRPE:

I have wrote a plugin for Nagios. That plugin should check the tomcat process. If I execute the by my self with the Nagios user everythig is ok. But in the GUI i can see this message:
StatusUNKNOWN and info ** NRPE: Unable to read output **

what had i done wrong :x ?? this is my code:

#include #include #include #include #include #include

using namespace std;

main(void)
{

char line_tmp[1000];
char find_stringII]=“tomcat”;
int result=0, check_sum=0;

FILE *tmp;

return 0;
/------------------------------CHECK TOMCAT-----------------------------/
system(“ps -e | grep java > procs.tmp”);

if((tmp = fopen( “procs.tmp”, “r” ))== NULL)
{
//cout << “Datei konnt nicht geöffnet werden” << endl;
}else
{
//cout << “Datei offen” <<endl;
}

do
{
fgets(line_tmp, sizeof(line_tmp), tmp);
//cout << line_tmp << endl;
if( (strstr(line_tmp, find_stringII)) != NULL)
{
result = 1;
break;
}
else if( (strstr(line_tmp, find_stringII)) == NULL )
{
result = 2;
}
}while(!feof(tmp));

if( result == 1 )
{
//cout << “der Prozess: " << find_stringII << " ist vorhanden” << endl;

}
else if( result == 2 )
{
//cout << “der Prozess: " << find_stringII << " ist nicht vorhanden” << endl;
check_sum++;

    }

fclose(tmp);

system(“rm procs.tmp”);

if(check_sum > 0)
{
fflush(stdin);
cout << “TOMCAT Prozess lauft nicht!!”<< endl;
return 2;
}
else if(check_sum == 0)
{
fflush(stdin);
cout << “TOMCAT Prozess lauft. :(” << endl;
return 0;
}
}

p.s.: sorry for my bad english :o
Edited ]

I have solved the problem!

Thx

How did you solve the problem?