summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9780795)
raw | patch | inline | side by side (parent: 9780795)
author | Florian Forster <octo@noris.net> | |
Thu, 27 Sep 2007 15:58:41 +0000 (15:58 +0000) | ||
committer | Florian Forster <octo@noris.net> | |
Thu, 27 Sep 2007 16:14:43 +0000 (16:14 +0000) |
src/snmp.c | patch | blob | history |
diff --git a/src/snmp.c b/src/snmp.c
index c12b3ec8fc43781edaffad4faa36d62eccf47f3f..5cc1b2d9b9acaaf599f70176f6143a075f8efd8c 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
- ERROR ("snmp plugin: snmp_sess_close failed: %s",
- (errstr == NULL) ? "Unknown problem" : errstr);
+ ERROR ("snmp plugin: host %s: snmp_sess_close failed: %s",
+ host->name, (errstr == NULL) ? "Unknown problem" : errstr);
sfree (errstr);
}
snmp_error (&sess, NULL, NULL, &errstr);
- ERROR ("snmp plugin: snmp_sess_open failed: %s",
- (errstr == NULL) ? "Unknown problem" : errstr);
+ ERROR ("snmp plugin: host %s: snmp_sess_open failed: %s",
+ host->name, (errstr == NULL) ? "Unknown problem" : errstr);
sfree (errstr);
}
} /* void csnmp_host_open_session */
DEBUG ("snmp plugin: csnmp_read_table (host = %s, data = %s)",
host->name, data->name);
+ if (host->sess_handle == NULL)
+ {
+ DEBUG ("snmp plugin: csnmp_read_table: host->sess_handle == NULL");
+ return (-1);
+ }
+
ds = plugin_get_ds (data->type);
if (!ds)
{
char *errstr = NULL;
snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
- ERROR ("snmp plugin: snmp_sess_synch_response failed: %s",
- (errstr == NULL) ? "Unknown problem" : errstr);
+ ERROR ("snmp plugin: host %s: snmp_sess_synch_response failed: %s",
+ host->name, (errstr == NULL) ? "Unknown problem" : errstr);
csnmp_host_close_session (host);
status = -1;
@@ -1028,6 +1034,12 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data)
DEBUG ("snmp plugin: csnmp_read_value (host = %s, data = %s)",
host->name, data->name);
+ if (host->sess_handle == NULL)
+ {
+ DEBUG ("snmp plugin: csnmp_read_table: host->sess_handle == NULL");
+ return (-1);
+ }
+
ds = plugin_get_ds (data->type);
if (!ds)
{
@@ -1079,8 +1091,8 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data)
char *errstr = NULL;
snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
- ERROR ("snmp plugin: snmp_sess_synch_response failed: %s",
- (errstr == NULL) ? "Unknown problem" : errstr);
+ ERROR ("snmp plugin: host %s: snmp_sess_synch_response failed: %s",
+ host->name, (errstr == NULL) ? "Unknown problem" : errstr);
csnmp_host_close_session (host);
sfree (errstr);