[Nagiosplug-devel] NRPE: Unable to ... HELP!!
Ighor Toth
ighor at brasilcenter.com.br
Thu Sep 30 05:04:07 CEST 2004
Hi, you must have to terminates the process which call a exit() function and return the exit status value.
0 - OK
1 - WARNING
2 - CRITICAL
3 - UNKNOW
Michal <navigato at interia.pl>@lists.sourceforge.net em 30/09/2004 05:59:40
Enviado Por: nagiosplug-devel-admin at lists.sourceforge.net
Para: nagiosplug-devel at lists.sourceforge.net
cc:
Assunto: [Nagiosplug-devel] NRPE: Unable to ... HELP!!
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 ?? this is my code:
<div class='indent'>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string>
#include <iostream>
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;
}
}
</div>
p.s.: sorry for my bad english
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Nagiosplug-devel mailing list
Nagiosplug-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
::: Please include plugins version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Devel
mailing list