[Nagios-devel] Nsca enhancement
Posted: Wed Feb 18, 2009 9:06 pm
Sorry if this should have gone to another mailing list, but I couldn't
find a better place from the nagios.org nor nagiosexchange.org websites
nor a google search.
Following is a short patch to allow the listen syscall backlog parameter
to be overridden. On Solaris 10 the default is 128 which for my
installation (~28000 passive checks in an hour with a bursty arrival
pattern) leads to many tcpListenDrop and unreliable nsca delivery.
This patch is against nsca v2.7.1
diff -u -r1.1.1.3 -r1.2
--- nsca.c 9 Apr 2007 06:44:37 -0000 1.1.1.3
+++ nsca.c 18 Feb 2009 19:38:04 -0000 1.2
@@ -25,6 +25,7 @@
static int server_port=3DDEFAULT_SERVER_PORT;
static char server_address[16]=3D"0.0.0.0";
static int socket_timeout=3DDEFAULT_SOCKET_TIMEOUT;
+static int listen_backlog=3DSOMAXCONN;
static char config_file[MAX_INPUT_BUFFER]=3D"nsca.cfg";
static char alternate_dump_file[MAX_INPUT_BUFFER]=3D"/dev/null";
@@ -347,6 +348,13 @@
return ERROR;
}
}
+ else if(!strcmp(varname,"listen_backlog")){
+ listen_backlog=3Datoi(varvalue);
+ if(listen_backlog<=3D0){
+ syslog(LOG_ERR,"list_backlog value,
'%s', is not an integer in config file '%s' - Line
%d\n",varvalue,filename,line);
+ return ERROR;
+ }
+ }
else if(!strcmp(varname,"server_address")){
=20
strncpy(server_address,varvalue,sizeof(server_address)
- 1);
=
server_address[sizeof(server_address)-1]=3D'\0';
@@ -707,7 +715,7 @@
}
/* open the socket for listening */
- if(listen(sock,SOMAXCONN)<0){
+ if(listen(sock,listen_backlog)<0){
syslog(LOG_ERR,"Network server listen failure (%d:
%s)\n",errno,strerror(errno));
do_exit(STATE_CRITICAL);
}
I've also added this to take advantage of the change.
--- nsca.cfg 2006/08/31 14:57:24 1.2
+++ nsca.cfg 2009/02/18 20:31:30
@@ -1,6 +1,6 @@
####################################################
#
-# $Header:
+# $Header:
#
# Sample NSCA Daemon Config File
# Written by: Ethan Galstad ([email protected])
@@ -25,7 +25,11 @@
server_port=3D5667
-
+# LISTEN BACKLOG
+# Overide the backlog parameter for the listen call, default SOMAXCONN
+# at least on Solaris 10 this is just 128 which is too small for highly
+# districuted setup
+listen_backlog=3D1024
Let me know if you have any questions.
Roy
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
find a better place from the nagios.org nor nagiosexchange.org websites
nor a google search.
Following is a short patch to allow the listen syscall backlog parameter
to be overridden. On Solaris 10 the default is 128 which for my
installation (~28000 passive checks in an hour with a bursty arrival
pattern) leads to many tcpListenDrop and unreliable nsca delivery.
This patch is against nsca v2.7.1
diff -u -r1.1.1.3 -r1.2
--- nsca.c 9 Apr 2007 06:44:37 -0000 1.1.1.3
+++ nsca.c 18 Feb 2009 19:38:04 -0000 1.2
@@ -25,6 +25,7 @@
static int server_port=3DDEFAULT_SERVER_PORT;
static char server_address[16]=3D"0.0.0.0";
static int socket_timeout=3DDEFAULT_SOCKET_TIMEOUT;
+static int listen_backlog=3DSOMAXCONN;
static char config_file[MAX_INPUT_BUFFER]=3D"nsca.cfg";
static char alternate_dump_file[MAX_INPUT_BUFFER]=3D"/dev/null";
@@ -347,6 +348,13 @@
return ERROR;
}
}
+ else if(!strcmp(varname,"listen_backlog")){
+ listen_backlog=3Datoi(varvalue);
+ if(listen_backlog<=3D0){
+ syslog(LOG_ERR,"list_backlog value,
'%s', is not an integer in config file '%s' - Line
%d\n",varvalue,filename,line);
+ return ERROR;
+ }
+ }
else if(!strcmp(varname,"server_address")){
=20
strncpy(server_address,varvalue,sizeof(server_address)
- 1);
=
server_address[sizeof(server_address)-1]=3D'\0';
@@ -707,7 +715,7 @@
}
/* open the socket for listening */
- if(listen(sock,SOMAXCONN)<0){
+ if(listen(sock,listen_backlog)<0){
syslog(LOG_ERR,"Network server listen failure (%d:
%s)\n",errno,strerror(errno));
do_exit(STATE_CRITICAL);
}
I've also added this to take advantage of the change.
--- nsca.cfg 2006/08/31 14:57:24 1.2
+++ nsca.cfg 2009/02/18 20:31:30
@@ -1,6 +1,6 @@
####################################################
#
-# $Header:
+# $Header:
#
# Sample NSCA Daemon Config File
# Written by: Ethan Galstad ([email protected])
@@ -25,7 +25,11 @@
server_port=3D5667
-
+# LISTEN BACKLOG
+# Overide the backlog parameter for the listen call, default SOMAXCONN
+# at least on Solaris 10 this is just 128 which is too small for highly
+# districuted setup
+listen_backlog=3D1024
Let me know if you have any questions.
Roy
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]