Re: [Nagios-devel] Re: [Pkg-nagios-devel] Bug#339366: After update, Nagios runs, but no status

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Re: [Pkg-nagios-devel] Bug#339366: After update, Nagios runs, but no status

Post by Guest »

--0eh6TmSyL6TZE2Uz
Content-Type: multipart/mixed; boundary="fdj2RfSjLxBAspz7"
Content-Disposition: inline


--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

hi ethan,

On Sat, Nov 26, 2005 at 12:58:15AM -0600, Ethan Galstad wrote:
> Thanks - I've just added some checks to the code to help cope with=20
> this problem.=20

cool--and i've just backported it to the 1.3 branch. if you're
interested, it's attached.


sean

--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="14_xdata_check-fulldisks.dpatch"
Content-Transfer-Encoding: quoted-printable

#! /bin/sh /usr/share/dpatch/dpatch-run
## 14_xdata_check-fulldisks.dpatch by
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: perform error checks on writes to the status log
## DP: backported by sean finney from the 2.0 cvs tree.

@DPATCH@
diff -urNad sid~/xdata/xsddefault.c sid/xdata/xsddefault.c
--- sid~/xdata/xsddefault.c 2002-02-26 05:04:11.000000000 +0100
+++ sid/xdata/xsddefault.c 2005-12-02 08:44:38.000000000 +0100
@@ -208,16 +208,26 @@
/* start aggregated dump */
int xsddefault_begin_aggregated_dump(void){
char buffer[MAX_INPUT_BUFFER];
+ char temp_buffer[MAX_INPUT_BUFFER];
=20
/* open a safe temp file for output */
snprintf(xsddefault_aggregate_temp_file,sizeof(xsddefault_aggregate_temp_=
file)-1,"%sXXXXXX",xsddefault_temp_file);
xsddefault_aggregate_temp_file[sizeof(xsddefault_aggregate_temp_file)-1]=
=3D'\x0';
- if((xsddefault_aggregate_fd=3Dmkstemp(xsddefault_aggregate_temp_file))=3D=
=3D-1)
+ if((xsddefault_aggregate_fd=3Dmkstemp(xsddefault_aggregate_temp_file))=3D=
=3D-1){
+ /* log an error */
+ snprintf(temp_buffer,sizeof(temp_buffer),"Error: Unable to create temp f=
ile for writing status data!\n");
+ temp_buffer[sizeof(temp_buffer)-1]=3D'\x0';
+ write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
return ERROR;
+ }
xsddefault_aggregate_fp=3Dfdopen(xsddefault_aggregate_fd,"w");
if(xsddefault_aggregate_fp=3D=3DNULL){
close(xsddefault_aggregate_fd);
unlink(xsddefault_aggregate_temp_file);
+ /* log an error */
+ snprintf(temp_buffer,sizeof(temp_buffer),"Error: Unable to open temp fil=
e '%s' for writing status data!\n",xsddefault_aggregate_temp_file);
+ temp_buffer[sizeof(temp_buffer)-1]=3D'\x0';
+ write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
return ERROR;
}
=20
@@ -232,6 +242,7 @@
=20
/* finish aggregated dump */
int xsddefault_end_aggregated_dump(void){
+ char temp_buffer[MAX_INPUT_BUFFER];
=20
/* reset file permissions */
fchmod(xsddefault_aggregate_fd,S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_=
IROTH);
@@ -241,8 +252,13 @@
close(xsddefault_aggregate_fd);
=20
/* move the temp file to the status log (overwrite the old status log) */
- if(my_rename(xsddefault_aggregate_temp_file,xsddefault_status_log))
+ if(my_rename(xsddefault_aggregate_temp_file,xsddefault_status_log)){
+ /* log an error */
+ snprintf(temp_buffer,sizeof(temp_buffer),"Error: Unable to update status=
data file '%s'!\n",xsddefault_status_log);
+ temp_buffer[sizeof(temp_buffer)-1]=3D'\x0';
+ write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
return ERROR;
+ }
=20
return OK;
}

--fdj2RfSjLxBAspz7--

--0eh6TmSyL6TZE2Uz
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFDkICWynjLPm522B0RAsryAJ4n84iM0Bl1/8MmWcY0aiFpKHunTwCeMKYA
m78QCICed+C8emGuJT+FxlY=
=T8uv
-----END PGP SIGNATURE-----

--0eh6TmSyL6TZE2Uz--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked