projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Actually add the testwrapper.sh script.
[collectd.git]
/
src
/
interface.c
diff --git
a/src/interface.c
b/src/interface.c
index
d9a0db3
..
d05dd72
100644
(file)
--- a/
src/interface.c
+++ b/
src/interface.c
@@
-89,13
+89,13
@@
static const char *config_keys[] =
static int config_keys_num = 2;
static ignorelist_t *ignorelist = NULL;
static int config_keys_num = 2;
static ignorelist_t *ignorelist = NULL;
-static _Bool unique_name = 0;
#ifdef HAVE_LIBKSTAT
#define MAX_NUMIF 256
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMIF];
static int numif = 0;
#ifdef HAVE_LIBKSTAT
#define MAX_NUMIF 256
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMIF];
static int numif = 0;
+static _Bool unique_name = 0;
#endif /* HAVE_LIBKSTAT */
static int interface_config (const char *key, const char *value)
#endif /* HAVE_LIBKSTAT */
static int interface_config (const char *key, const char *value)
@@
-116,8
+116,12
@@
static int interface_config (const char *key, const char *value)
}
else if (strcasecmp (key, "UniqueName") == 0)
{
}
else if (strcasecmp (key, "UniqueName") == 0)
{
+ #ifdef HAVE_LIBKSTAT
if (IS_TRUE (value))
unique_name = 1;
if (IS_TRUE (value))
unique_name = 1;
+ #else
+ WARNING ("interface plugin: the \"UniqueName\" option is only valid on Solaris.");
+ #endif /* HAVE_LIBKSTAT */
}
else
{
}
else
{
@@
-186,7
+190,7
@@
static int interface_read (void)
struct ifaddrs *if_list;
struct ifaddrs *if_ptr;
struct ifaddrs *if_list;
struct ifaddrs *if_ptr;
-/* Darin/Mac OS X and possible other *BSDs */
+/* Dar
w
in/Mac OS X and possible other *BSDs */
#if HAVE_STRUCT_IF_DATA
# define IFA_DATA if_data
# define IFA_RX_BYTES ifi_ibytes
#if HAVE_STRUCT_IF_DATA
# define IFA_DATA if_data
# define IFA_RX_BYTES ifi_ibytes
@@
-282,6
+286,10
@@
static int interface_read (void)
incoming = atoll (fields[2]);
outgoing = atoll (fields[10]);
if_submit (device, "if_errors", incoming, outgoing);
incoming = atoll (fields[2]);
outgoing = atoll (fields[10]);
if_submit (device, "if_errors", incoming, outgoing);
+
+ incoming = atoll (fields[3]);
+ outgoing = atoll (fields[11]);
+ if_submit (device, "if_dropped", incoming, outgoing);
}
fclose (fh);
}
fclose (fh);
@@
-302,9
+310,9
@@
static int interface_read (void)
continue;
if (unique_name)
continue;
if (unique_name)
- snprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module, ksp[i]->ks_instance, ksp[i]->ks_name);
+ s
s
nprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module, ksp[i]->ks_instance, ksp[i]->ks_name);
else
else
- s
nprintf(iname, sizeof(iname), "%s", ksp[i]->ks_name
);
+ s
strncpy(iname, ksp[i]->ks_name, sizeof(iname)
);
/* try to get 64bit counters */
rx = get_kstat_value (ksp[i], "rbytes64");
/* try to get 64bit counters */
rx = get_kstat_value (ksp[i], "rbytes64");
@@
-360,9
+368,8
@@
static int interface_read (void)
if (pnif != nif || ifstat == NULL)
{
if (pnif != nif || ifstat == NULL)
{
- if (ifstat != NULL)
- free(ifstat);
- ifstat = malloc(nif * sizeof(perfstat_netinterface_t));
+ free(ifstat);
+ ifstat = malloc(nif * sizeof (*ifstat));
}
pnif = nif;
}
pnif = nif;