jer 15/06/14 08:00:16
Added: cacti-spine-0.8.8d-mysql.patch
cacti-spine-0.8.8d-ping.patch
cacti-spine-0.8.8d-snmp_spine_close.patch
cacti-spine-0.8.8d-polling_time.patch
cacti-spine-0.8.8d-net-snmp.patch
Log:
Add build/compatibility patches (bug #552030 by Tomasz Chilinski).
(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key
A792A613)
Revision Changes Path
1.1
net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-mysql.patch
file :
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-mysql.patch?rev=1.1&view=markup
plain:
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-mysql.patch?rev=1.1&content-type=text/plain
Index: cacti-spine-0.8.8d-mysql.patch
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -239,7 +239,7 @@
fi
CFLAGS="-I$MYSQL_INC_DIR $CFLAGS"
-AC_CHECK_LIB(mysqlclient_r,mysql_init, LIBS="-lmysqlclient_r",
+AC_CHECK_LIB(mysqlclient_r,mysql_init, LIBS="$LIBS -lmysqlclient_r",
AC_MSG_ERROR([MySQL libraries not found])
)
1.1
net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-ping.patch
file :
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-ping.patch?rev=1.1&view=markup
plain:
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-ping.patch?rev=1.1&content-type=text/plain
Index: cacti-spine-0.8.8d-ping.patch
===================================================================
--- a/ping.c
+++ b/ping.c
@@ -813,7 +813,7 @@
int rv;
buf = malloc(len*sizeof(char));
- memset(buf, 0, sizeof(buf));
+ memset(buf, 0, len*sizeof(char));
while (1) {
rv = gethostbyname_r(hostname, &result_buf, buf, len,
1.1
net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-snmp_spine_close.patch
file :
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-snmp_spine_close.patch?rev=1.1&view=markup
plain:
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-snmp_spine_close.patch?rev=1.1&content-type=text/plain
Index: cacti-spine-0.8.8d-snmp_spine_close.patch
===================================================================
--- a/snmp.h
+++ b/snmp.h
@@ -32,6 +32,7 @@
*/
extern void snmp_spine_init(void);
+extern void snmp_spine_close(void);
extern void *snmp_host_init(int host_id, char *hostname, int snmp_version,
char *snmp_community, char *snmp_username, char *snmp_password, char
*snmp_auth_protocol, char *snmp_priv_passphrase, char *snmp_priv_protocol, char
*snmp_context, int snmp_port, int snmp_timeout);
extern void snmp_host_cleanup(void *snmp_session);
extern char *snmp_get(host_t *current_host, char *snmp_oid);
1.1
net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-polling_time.patch
file :
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-polling_time.patch?rev=1.1&view=markup
plain:
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-polling_time.patch?rev=1.1&content-type=text/plain
Index: cacti-spine-0.8.8d-polling_time.patch
===================================================================
--- a/poller.c
+++ b/poller.c
@@ -168,7 +168,6 @@
MYSQL mysql;
MYSQL_RES *result;
MYSQL_ROW row;
- MYSQL_FIELD *field;
db_connect(set.dbdb, &mysql);
@@ -218,8 +217,7 @@
"status, status_event_count, status_fail_date, "
"status_rec_date, status_last_error, "
"min_time, max_time, cur_time, avg_time, "
- "total_polls, failed_polls, availability,
snmp_sysUptimeInstance, snmp_sysDescr, snmp_sysObjectID, "
- "snmp_sysContact, snmp_sysName, snmp_sysLocation"
+ "total_polls, failed_polls, availability "
" FROM host"
" WHERE id=%i", host_id);
@@ -289,8 +287,7 @@
"status, status_event_count, status_fail_date, "
"status_rec_date, status_last_error, "
"min_time, max_time, cur_time, avg_time, "
- "total_polls, failed_polls, availability,
snmp_sysUptimeInstance, snmp_sysDescr, snmp_sysObjectID, "
- "snmp_sysContact, snmp_sysName,
snmp_sysLocation"
+ "total_polls, failed_polls, availability "
" FROM host"
" WHERE id=%i", host_id);
@@ -379,44 +376,38 @@
if (row) {
/* initialize variables first */
- host->id = 0;
// 0
- host->hostname[0] = '\0';
// 1
- host->snmp_session = NULL;
// -
- host->snmp_community[0] = '\0';
// 2
- host->snmp_version = 1;
// 3
- host->snmp_username[0] = '\0';
// 4
- host->snmp_password[0] = '\0';
// 5
- host->snmp_auth_protocol[0] = '\0';
// 6
- host->snmp_priv_passphrase[0] = '\0';
// 7
- host->snmp_priv_protocol[0] = '\0';
// 8
- host->snmp_context[0] = '\0';
// 9
- host->snmp_port = 161;
// 10
- host->snmp_timeout = 500;
// 11
- host->snmp_retries =
set.snmp_retries; // -
- host->max_oids = 10;
// 12
- host->availability_method = 0;
// 13
- host->ping_method = 0;
// 14
- host->ping_port = 23;
// 15
- host->ping_timeout = 500;
// 16
- host->ping_retries = 2;
// 17
- host->status = HOST_UP;
// 18
- host->status_event_count = 0;
// 19
- host->status_fail_date[0] = '\0';
// 20
- host->status_rec_date[0] = '\0';
// 21
- host->status_last_error[0] = '\0';
// 22
- host->min_time = 0;
// 23
- host->max_time = 0;
// 24
- host->cur_time = 0;
// 25
- host->avg_time = 0;
// 26
- host->total_polls = 0;
// 27
- host->failed_polls = 0;
// 28
- host->availability = 100;
// 29
- host->snmp_sysUpTimeInstance = 0;
// 30
- host->snmp_sysDescr[0] = '\0';
// 31
- host->snmp_sysObjectID[0] = '\0';
// 32
- host->snmp_sysContact[0] = '\0';
// 33
- host->snmp_sysName[0] = '\0';
// 34
- host->snmp_sysLocation[0] = '\0';
// 35
+ host->id = 0;
+ host->hostname[0] = '\0';
+ host->snmp_session = NULL;
+ host->snmp_community[0] = '\0';
+ host->snmp_version = 1;
+ host->snmp_username[0] = '\0';
+ host->snmp_password[0] = '\0';
+ host->snmp_auth_protocol[0] = '\0';
+ host->snmp_priv_passphrase[0] = '\0';
+ host->snmp_priv_protocol[0] = '\0';
+ host->snmp_context[0] = '\0';
+ host->snmp_port = 161;
+ host->snmp_timeout = 500;
+ host->snmp_retries =
set.snmp_retries;
+ host->max_oids = 10;
+ host->availability_method = 0;
+ host->ping_method = 0;
+ host->ping_port = 23;
+ host->ping_timeout = 500;
+ host->ping_retries = 2;
+ host->status = HOST_UP;
+ host->status_event_count = 0;
+ host->status_fail_date[0] = '\0';
+ host->status_rec_date[0] = '\0';
+ host->status_last_error[0] = '\0';
+ host->min_time = 0;
+ host->max_time = 0;
+ host->cur_time = 0;
+ host->avg_time = 0;
+ host->total_polls = 0;
+ host->failed_polls = 0;
+ host->availability = 100;
/* populate host structure */
host->ignore_host = FALSE;
@@ -460,13 +451,6 @@
if (row[28] != NULL) host->failed_polls =
atoi(row[28]);
if (row[29] != NULL) host->availability =
atof(row[29]);
- if (row[30] != NULL)
host->snmp_sysUpTimeInstance=atoi(row[30]);
- if (row[31] != NULL)
STRNCOPY(host->snmp_sysDescr, row[31]);
- if (row[32] != NULL)
STRNCOPY(host->snmp_sysObjectID, row[32]);
- if (row[33] != NULL)
STRNCOPY(host->snmp_sysContact, row[33]);
- if (row[34] != NULL)
STRNCOPY(host->snmp_sysName, row[34]);
- if (row[35] != NULL)
STRNCOPY(host->snmp_sysLocation, row[35]);
-
/* correct max_oid bounds issues */
if ((host->max_oids == 0) || (host->max_oids >
100)) {
SPINE_LOG(("Host[%i] TH[%i] WARNING:
Max OIDS is out of range with value of '%i'. Resetting to default of 5",
host_id, host_thread, host->max_oids));
@@ -510,12 +494,6 @@
host->ignore_host = FALSE;
if (host_thread == 1) {
update_host_status(HOST_UP, host, ping, host->availability_method);
-
- if
(host->availability_method == AVAIL_SNMP) {
-
get_system_information(host, &mysql);
-
-
- }
}
}else{
host->ignore_host = TRUE;
@@ -531,9 +509,7 @@
"SET status='%i',
status_event_count='%i', status_fail_date='%s',"
" status_rec_date='%s',
status_last_error='%s', min_time='%f',"
" max_time='%f',
cur_time='%f', avg_time='%f', total_polls='%i',"
- " failed_polls='%i',
availability='%.4f', snmp_sysDescr='%s', "
- "
snmp_sysObjectID='%s', snmp_sysUpTimeInstance='%i', "
- " snmp_sysContact='%s',
snmp_sysName='%s', snmp_sysLocation='%s' "
+ " failed_polls='%i',
availability='%.4f' "
"WHERE id='%i'",
host->status,
host->status_event_count,
@@ -547,12 +523,6 @@
host->total_polls,
host->failed_polls,
host->availability,
- host->snmp_sysDescr,
- host->snmp_sysObjectID,
- host->snmp_sysUpTimeInstance,
- host->snmp_sysContact,
- host->snmp_sysName,
- host->snmp_sysLocation,
host->id);
db_insert(&mysql, update_sql);
@@ -1285,10 +1255,6 @@
poll_time = get_time_as_double() - poll_time;
SPINE_LOG_MEDIUM(("Host[%i] TH[%i] Total Time: %5.2g Seconds", host_id,
host_thread, poll_time));
- query1[0] = '\0';
- snprintf(query1, BUFSIZE, "UPDATE host SET polling_time='%g' WHERE
id=%i", poll_time, host_id);
- db_query(&mysql, query1);
-
mysql_close(&mysql);
#ifndef OLD_MYSQL
@@ -1343,50 +1309,6 @@
}
-void get_system_information(host_t *host, MYSQL *mysql) {
- snmp_oids_t *snmp_oids;
-
- if (set.mibs) {
- int num_oids = 6;
-
- /* create an array for snmp oids */
- snmp_oids = (snmp_oids_t *) calloc(num_oids,
sizeof(snmp_oids_t));
-
- /* initialize all the memory to insure we don't get issues */
- memset(snmp_oids, 0, sizeof(snmp_oids_t)*num_oids);
-
- STRNCOPY(snmp_oids[0].oid, ".1.3.6.1.2.1.1.1.0");
- STRNCOPY(snmp_oids[1].oid, ".1.3.6.1.2.1.1.2.0");
- STRNCOPY(snmp_oids[2].oid, ".1.3.6.1.2.1.1.3.0");
- STRNCOPY(snmp_oids[3].oid, ".1.3.6.1.2.1.1.4.0");
- STRNCOPY(snmp_oids[4].oid, ".1.3.6.1.2.1.1.5.0");
- STRNCOPY(snmp_oids[5].oid, ".1.3.6.1.2.1.1.6.0");
- snmp_get_multi(host, snmp_oids, num_oids);
-
- mysql_real_escape_string(mysql, host->snmp_sysDescr,
snmp_oids[0].result, strlen(snmp_oids[0].result));
- mysql_real_escape_string(mysql, host->snmp_sysObjectID,
snmp_oids[1].result, strlen(snmp_oids[1].result));
- host->snmp_sysUpTimeInstance = atoi(snmp_oids[2].result);
- mysql_real_escape_string(mysql, host->snmp_sysContact,
snmp_oids[3].result, strlen(snmp_oids[3].result));
- mysql_real_escape_string(mysql, host->snmp_sysName,
snmp_oids[4].result, strlen(snmp_oids[4].result));
- mysql_real_escape_string(mysql, host->snmp_sysLocation,
snmp_oids[5].result, strlen(snmp_oids[5].result));
- }else{
- int num_oids = 1;
-
- /* create an array for snmp oids */
- snmp_oids = (snmp_oids_t *) calloc(num_oids,
sizeof(snmp_oids_t));
-
- /* initialize all the memory to insure we don't get issues */
- memset(snmp_oids, 0, sizeof(snmp_oids_t)*num_oids);
-
- STRNCOPY(snmp_oids[0].oid, ".1.3.6.1.2.1.1.3.0");
- snmp_get_multi(host, snmp_oids, num_oids);
-
- host->snmp_sysUpTimeInstance = atoi(snmp_oids[2].result);
- }
-
- free(snmp_oids);
-}
-
/*! \fn int validate_result(char *result)
* \brief validates the output from the polling action is valid
* \param result the value to be checked for legality
1.1
net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-net-snmp.patch
file :
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-net-snmp.patch?rev=1.1&view=markup
plain:
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/cacti-spine/files/cacti-spine-0.8.8d-net-snmp.patch?rev=1.1&content-type=text/plain
Index: cacti-spine-0.8.8d-net-snmp.patch
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -254,14 +254,14 @@
)
AC_MSG_CHECKING([if Net-SNMP needs crypto support])
-AC_TRY_COMPILE([#include <net-snmp-config.h>], [exit(USE_OPENSSL != 1);],
+AC_TRY_COMPILE([#include <net-snmp/net-snmp-config.h>], [exit(USE_OPENSSL !=
1);],
[ AC_MSG_RESULT(yes)
SNMP_SSL=yes
],
AC_MSG_RESULT(no)
)
-AC_TRY_COMPILE([ #include <net-snmp-config.h>
+AC_TRY_COMPILE([ #include <net-snmp/net-snmp-config.h>
#include <net-snmp/utilities.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/config_api.h>
--- a/common.h
+++ b/common.h
@@ -125,7 +125,7 @@
# include <priv.h>
#endif
-#ifdef USE_NET_SNMP
+#ifdef HAVE_LIBNETSNMP
#undef PACKAGE_NAME
#undef PACKAGE_VERSION
#undef PACKAGE_BUGREPORT