summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f47fafa)
raw | patch | inline | side by side (parent: f47fafa)
author | Fabian Schuh <mail@xeroc.org> | |
Fri, 19 Mar 2010 12:53:30 +0000 (13:53 +0100) | ||
committer | Fabian Schuh <mail@xeroc.org> | |
Fri, 19 Mar 2010 12:53:30 +0000 (13:53 +0100) |
src/openvpn.c | patch | blob | history |
diff --git a/src/openvpn.c b/src/openvpn.c
index b03ae96444d53b5c932e2ece3ee4f5610e11304f..c3d5916ea849ab84c0b138212ec66d2c0c5e879f 100644 (file)
--- a/src/openvpn.c
+++ b/src/openvpn.c
static int store_compression = 1;
static int new_naming_schema = 0;
static int number_connectedusers = 0;
+static int number_connectedusers_only = 0;
static const char *config_keys[] =
{
"StatusFile",
"Compression",
"ImprovedNamingSchema",
- "AggregateUsers"
+ "AggregateUsers",
+ "OnlyAggregateUsers"
};
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
{
sum_users += 1;
}
-
- if (new_naming_schema)
- {
- iostats_submit (fields[0], /* "Common Name" */
- NULL, /* unused when in multimode */
- atoll (fields[2]), /* "Bytes Received" */
- atoll (fields[3])); /* "Bytes Sent" */
- }
- else
+ if (number_connectedusers_only==0)
{
- iostats_submit (name, /* vpn instance */
- fields[0], /* "Common Name" */
- atoll (fields[2]), /* "Bytes Received" */
- atoll (fields[3])); /* "Bytes Sent" */
+ if (new_naming_schema)
+ {
+ iostats_submit (fields[0], /* "Common Name" */
+ NULL, /* unused when in multimode */
+ atoll (fields[2]), /* "Bytes Received" */
+ atoll (fields[3])); /* "Bytes Sent" */
+ }
+ else
+ {
+ iostats_submit (name, /* vpn instance */
+ fields[0], /* "Common Name" */
+ atoll (fields[2]), /* "Bytes Received" */
+ atoll (fields[3])); /* "Bytes Sent" */
+ }
}
read = 1;
}
- if (number_connectedusers && read == 1)
+ if (number_connectedusers)
{
numusers_submit(name, name, sum_users);
+ read = 1;
}
return (read);
{
sum_users += 1;
}
-
- if (new_naming_schema)
- {
- /* plugin inst = file name, type inst = fields[1] */
- iostats_submit (name, /* vpn instance */
- fields[1], /* "Common Name" */
- atoll (fields[4]), /* "Bytes Received" */
- atoll (fields[5])); /* "Bytes Sent" */
- }
- else
+ if (number_connectedusers_only==0)
{
- /* plugin inst = fields[1], type inst = "" */
- iostats_submit (fields[1], /* "Common Name" */
- NULL, /* unused when in multimode */
- atoll (fields[4]), /* "Bytes Received" */
- atoll (fields[5])); /* "Bytes Sent" */
+ if (new_naming_schema)
+ {
+ /* plugin inst = file name, type inst = fields[1] */
+ iostats_submit (name, /* vpn instance */
+ fields[1], /* "Common Name" */
+ atoll (fields[4]), /* "Bytes Received" */
+ atoll (fields[5])); /* "Bytes Sent" */
+ }
+ else
+ {
+ /* plugin inst = fields[1], type inst = "" */
+ iostats_submit (fields[1], /* "Common Name" */
+ NULL, /* unused when in multimode */
+ atoll (fields[4]), /* "Bytes Received" */
+ atoll (fields[5])); /* "Bytes Sent" */
+ }
}
read = 1;
}
- if (number_connectedusers && read == 1)
+ if (number_connectedusers)
{
- numusers_submit(name, name, sum_users);
- }
+ numusers_submit(name, name, sum_users);
+ read = 1;
+ }
return (read);
} /* int multi2_read */
sum_users += 1;
}
- if (new_naming_schema)
+ if (number_connectedusers_only==0)
{
- iostats_submit (name, /* vpn instance */
- fields[1], /* "Common Name" */
- atoll (fields[4]), /* "Bytes Received" */
- atoll (fields[5])); /* "Bytes Sent" */
- }
- else
- {
- iostats_submit (fields[1], /* "Common Name" */
- NULL, /* unused when in multimode */
- atoll (fields[4]), /* "Bytes Received" */
- atoll (fields[5])); /* "Bytes Sent" */
+ if (new_naming_schema)
+ {
+ iostats_submit (name, /* vpn instance */
+ fields[1], /* "Common Name" */
+ atoll (fields[4]), /* "Bytes Received" */
+ atoll (fields[5])); /* "Bytes Sent" */
+ }
+ else
+ {
+ iostats_submit (fields[1], /* "Common Name" */
+ NULL, /* unused when in multimode */
+ atoll (fields[4]), /* "Bytes Received" */
+ atoll (fields[5])); /* "Bytes Sent" */
+ }
}
read = 1;
}
}
- if (number_connectedusers && read == 1)
+ if (number_connectedusers)
{
numusers_submit(name, name, sum_users);
+ read = 1;
}
return (read);
number_connectedusers = 0;
}
} /* if (strcasecmp("AggregateUsers", key) == 0) */
+ else if (strcasecmp("OnlyAggregateUsers", key) == 0)
+ {
+ if (IS_TRUE(value))
+ {
+ DEBUG ("openvpn plugin: Summing up all users");
+ number_connectedusers_only = 1;
+ number_connectedusers = 1;
+ }
+ else
+ {
+ number_connectedusers_only = 0;
+ }
+ } /* if (strcasecmp("OnlyAggregateUsers", key) == 0) */
else
{
return (-1);