Hi i have a plugin written in c that will parse a .log<server log> file and determine the page hit count
_xLogFileName = "loging.log";
_xFile = fopen ( _xLogFileName, "r" );
if ( _xFile != NULL )
{
// process file
}else
{
printf("error\n");
return 3;
}
now i placed the a.out file in /usr/lib/nagios/plugin folder and placed the "loging.log" file in the same folder- for both chmod 777 done. now i can run the plugin from command line but when i integrate the same with nagios then it is giving unknown status and printing the "error" from else part-- can anyone plese help
Nagios plugin unable to open external log file for reading
Re: Nagios plugin unable to open external log file for readi
Well, looking at your code snippet, I would say that your _xFile is 'NULL', but you probably knew that. Any information in you nagios logs or system messages? Does the initial file exist?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Nagios plugin unable to open external log file for readi
Ya, The problem is solved now. Actually nagios is searching the "loging.log" file in me / directory. which i identify , when i printf a PWD in the code. So i placed the loging.log file there and it is working fine.
But it will not work when i deploy the same to a server. so searching for the solution to find the relative path of the file
But it will not work when i deploy the same to a server. so searching for the solution to find the relative path of the file
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Nagios plugin unable to open external log file for readi
Hmm, interesting, let us know how this goes!
Re: Nagios plugin unable to open external log file for readi
Hmnn my plugin is working fine now,
./check_page_hit -f loging.log
loging.log is the file name. And it is parsing the log file and calculate the page hit in the application and it is also generating the perf data
./check_page_hit -f loging.log
loging.log is the file name. And it is parsing the log file and calculate the page hit in the application and it is also generating the perf data