Code

Merge branch 'fs/openvpn'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 22 Mar 2010 18:29:13 +0000 (19:29 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 22 Mar 2010 18:29:13 +0000 (19:29 +0100)
Conflicts:
src/collectd.conf.pod
src/openvpn.c

1  2 
src/collectd.conf.pod
src/openvpn.c

index a12a48b64d88701d245be3da5f48b9cccb194848,b1544e8d74850a972c7c9c13c772f6d97a7ad57b..facb058959e488018aab5c7ed8f5cb67d55f4eff
@@@ -2776,14 -2776,7 +2776,14 @@@ Available options
  
  Specifies the location of the status file.
  
- =item B<Compression> B<true>|B<false>
 +=item B<ImprovedNamingSchema> B<true>|B<false>
 +
 +When enabled, the filename of the status file will be used as plugin instance
 +and the client's "common name" will be used as type instance. This is required
 +when reading multiple status files. Enabling this option is recommended, but to
 +maintain backwards compatibility this option is disabled by default.
 +
+ =item B<CollectCompression> B<true>|B<false>
  
  Sets whether or not statistics about the compression used by OpenVPN should be
  collected. This information is only available in I<single> mode. Enabled by
diff --cc src/openvpn.c
index 9c717dd0a64a0f9511473c0c976f10c0f31bd639,8c0f82db12d30a2e84c43fcfc6217d774e3bb931..2aca4145cdae3d36c2e1ead682b9ab0343a418b6
@@@ -261,19 -290,27 +290,27 @@@ static int multi1_read (char *name, FIL
                if (fields_num < 4)
                        continue;
  
-               if (new_naming_schema)
+               if (collect_user_count)
+                       /* If so, sum all users, ignore the individuals*/
                {
-                       iostats_submit (name,               /* vpn instance */
-                                       fields[0],          /* "Common Name" */
-                                       atoll (fields[2]),  /* "Bytes Received" */
-                                       atoll (fields[3])); /* "Bytes Sent" */
+                       sum_users += 1;
                }
-               else
+               if (collect_individual_users)
                {
-                       iostats_submit (fields[0],          /* "Common Name" */
-                                       NULL,               /* unused when in multimode */
-                                       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 */
++                              iostats_submit (name,               /* vpn instance */
++                                              fields[0],          /* "Common Name" */
+                                               atoll (fields[2]),  /* "Bytes Received" */
+                                               atoll (fields[3])); /* "Bytes Sent" */
+                       }
+                       else
+                       {
 -                              iostats_submit (name,               /* vpn instance */
 -                                              fields[0],          /* "Common Name" */
++                              iostats_submit (fields[0],          /* "Common Name" */
++                                              NULL,               /* unused when in multimode */
+                                               atoll (fields[2]),  /* "Bytes Received" */
+                                               atoll (fields[3])); /* "Bytes Sent" */
+                       }
                }
  
                read = 1;