nagios - cgiutil.c - get_nagios_process_info and PgSQL
White_Angel
White_Angel at gmx.de
Mon Jun 23 02:02:00 CEST 2003
Hello,
I'm trying nagios with postgre SQL Support an foudn some strange thinks.
My Questions:
1. If the Status Infos are in pgsql - Is it right that no status.log is
createt?
2. When there are no nagios_check_command in cgi.cfg - the cmd.cgi is
disabled. Why ?
3. The check_nagios need the status.log - or it doesn't work ?
For me i have the following solution:
I patched the cgiutil.c with the following patch:
Version 1.1 cgiutil.c
--- nagios-1.1.orginal/cgi/cgiutils.c 2002-11-11 04:52:13.000000000 +0100
+++ nagios-1.1/cgi/cgiutils.c 2003-06-23 01:11:58.000000000 +0200
@@ -1233,6 +1233,27 @@
}
/* else run the check... */
+/* PATCH by Gabor JANAK - Get the nagios Status from the programstatus table
*/
+ else
+ if(!strncmp(nagios_check_command,"xsddb",5)){
+ int expire_minutes=atoi(nagios_check_command+5);
+ time_t current_time;
+ /* Check count of Running Nagios */
+ int proc_entries = 1;
+ /* Check Last update Time */
+
+ time (¤t_time);
+ if ((current_time - last_command_check) > (expire_minutes *
60))
+ process_state = STATE_WARNING;
+ snprintf(nagios_process_info,MAX_INPUT_BUFFER-2,"Nagios %s:
located %d process%s, status log updated %d second%s ago\n",
+ (process_state == STATE_OK) ? "ok"
: "problem",
+ proc_entries,
+ (proc_entries == 1) ? "" : "es",
+ (int) (current_time -
last_command_check),
+ ((int) (current_time -
last_command_check) == 1) ? "" : "s"
+ );
+ }
+/* PATCH END */
else{
/* clear out the old check results */
#SNIP#
It's a little Bit tricky but it works.
the nagios_check_command should now be the file or xddb [EXPIRE MINUTES]
I have checked it with the actual 1.1 Version.
in the CVS it must work too, but the CVS has to many errors for me.
If some thinks this would be nice to integrat ... i would add the proc count
...
In Best regards Gabor
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
More information about the Developers
mailing list