[BACK]Return to patch-src_cpu.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / sysutils / collectd / patches

File: [cvs.NetBSD.org] / pkgsrc / sysutils / collectd / patches / Attic / patch-src_cpu.c (download)

Revision 1.2, Thu Oct 13 15:17:28 2016 UTC (7 years, 5 months ago) by fhajny
Branch: MAIN
Changes since 1.1: +21 -21 lines

Update sysutils/collectd and subpackages to 5.6.1.

- Simplify patching somewhat by calling automake
- Temporarily disable the processes plugin patch for NetBSD, until
  its code is amended for collectd code changes.

Version 5.6.1
- Build system: Unnecessary linking of the Write Graphite plugin
  with libyajl has been removed.
- collectd: A bug in the FlushInterval option that caused a
  segmentation fault in the Write HTTP plugin has been fixed.
- Apache plugin: A syntax error has been fixed.
- cURL-JSON plugin: A segmentation fault that occurred when
  handling JSON with unexpected structure has been fixed.
- PostgreSQL plugin: Handling of NULL values in the query_plans
  and query_plans_by_table queries has been fixed.
- RRDCacheD plugin: Reconnection behavior has been added.
- VServer plugin: Use of a deprecated API (readdir_r()) has been
  fixed.
- Write Graphite plugin: Make default values configurable at
  compile time again.
- Write HTTP plugin: A bug has been fixed that lead to flush
  callbacks being registered twice.

Version 5.6.0
- Build system: An option to to avoid building the DF plugin
  against XFS has been added.
- Build system: Autoconf >=2.60, a C99-capable compiler and
  pkg-config are now required.
- Build system: Building with -Werror is now optional.
- Build system: Many compilation issues on non-Linux platforms
  have been fixed, leading to wider plugin support.
- Build system: The configuration summary now also ends up in
  config.log.
- collectd: All command-line options now override global options
  from the config file.
- collectd: A number of unit tests for commonly used functions
  have been added.
- collectd: Plugins start up and read timeouts are now logged.
- collectd: Support for a timeout has been added to FLUSH
  callbacks.
- collectd: The -T command line switch now reports more errors.
- collectd: The max size of value list elements
  (DATA_MAX_NAME_LEN) has been doubled and is now configurable at
  build time.
- Set target: The MetaData option has been added.
- AMQP plugin, Write_HTTP plugin, Write_Kafka plugin: Support for
  libyajl < 2 has been added.
- APC UPS plugin: Parsing of end markers has been fixed.
- APC UPS plugin: The PersistentConnection option has been added.
- ceph plugin, DNS plugin, Exec plugin, IPTables plugin, Ping
  plugin, turbostat plugin: When running unprivileged, these
  plugins will now warn about insuffiscient permissions or
  capabilities(7).
- Chrony plugin: This new plugin collects NTP data from the chrony
  NTP server.
- cpusleep plugin: This new plugin measures time spent by CPU in
  deep sleep mode.
- CPU plugin: The ReportNumCpu option has been added.
- cURL plugin, cURL-JSON plugin, cURL-XML plugin: The new
  Statistics reports various per-HTTP connection timers.
- DBI plugin: The Interval option has been added to Database
  blocks.
- Disk plugin: Support for FreeBSD has been added.
- Empty Counter match: Support for derives has been implemented.
- GenericJMX plugin: Support for TabularData and the PluginName
  option have been added.
- GPS plugin: This new plugin reports the number of sattelites
  seen by and precision of a GPS receiver.
- gRPC plugin: This new client and server plugin allows sending
  and receiving metrics using the gRPC protocol. Comparable to the
  UnixSock plugin, but using TCP and TLS.
- Interface plugin: Reporting dropped packets has been added.
- Interface plugin: The ReportInactive has been added, letting
  users skip inactive network interfaces.
- Interface plugin: The new, Solaris-only UniqueName option has
  been added.
- Lua plugin: This new language binding allows writing plugins
  using the Lua programming language.
- Memory plugin: Reporting of ARC memory on Solaris has been
  added.
- MQTT plugin: This new plugin sends metrics to and/or receives
  metrics from an MQTT broker.
- MySQL plugin: Connection to the database server can now be done
  over SSL.
- MySQL plugin: Monitoring slow queries has been added.
- MySQL plugin: mysql_bpool_pages-flushed has been renamed to
  mysql_bpool_counters-pages_flushed because the value is
  cumulative.
- MySQL plugin: Support for Galera statistics has been added.
- MySQL plugin: Support for InnoDB metrics was improved.
- MySQL plugin: The mysql_sort type has been split into 3
  different types.
- Network plugin: Decryption error logging has been improved.
- Notify Nagios plugin: This new plugin sends notifications to
  Nagios as a passive check result.
- NTPd plugin: The plugin now detects if the ntp daemon reports
  nanoseconds instead of microseconds.
- OpenLDAP plugin: Several connection-related improvements have
  been made.
- OpenLDAP plugin: Support for "simple authentication" has been
  added.
- Ping plugin: The Size option has been added, allowing the ICMP
  data payload size to be configured.
- PostgreSQL plugin, DBI plugin, Oracle plugin: The new
  PluginInstanceFrom option has been added.
- PowerDNS plugin: The recursor metrics have been updated to 3.7.3
  and missing rr types have been added.
- Processes plugin: Counting of context switches was added for
  Linux.
- Processes plugin: Improve reliability of thread counts on Linux.
- Python plugin: Minimal Python version requirement has been
  bumped to 2.6.
- Redis plugin: Several additional metrics are now collected.
- Sensors plugin: The UseLabels option has been added.
- SMART plugin: The new IgnoreSleepMode option has been added.
- SMART plugin: The new UseSerial option allows identifying
  devices in a stable way.
- SNMP plugin: The IpAddress can now be used for instances.
- StatsD plugin: Latency calculation histogram is now able to
  shrink automatically to optimal size.
- StatsD plugin: The CounterSum option has been added.
- UUID plugin: The plugin now also looks in in smbios system table
  and /sys/class/dmi.
- virt plugin: The PluginInstanceFormat option has been added.
- Write Graphite plugin: The ReconnectInterval option has been
  added.
- Write HTTP plugin: A KairosDB formatter has been added.
- Write HTTP plugin: Notifications are now handled by this plugin.
- Write HTTP plugin: The LogHttpError option has been added.
- Write HTTP plugin: The new Headers option allows setting custom
  HTTP headers in outgoing requests.
- Write Kafka plugin: Key handling has been made more
  comprehensive and reliable.
- Write Redis plugin: The Database, MaxSetSize, Prefix and
  StoreRates options have been added.
- Write Riemann plugin: The new BatchFlushTimeout and Timeout
  option have been added.
- Write Riemann plugin: This plugin now requires the
  riemann-c-client library, version 1.6.0+. This adds support for
  submitting values to Riemann over TLS.
- Write TSDB plugin, Write Sensu plugin, Write Riemann plugin,
  Write Graphite plugin, Write TSDB plugin: TCP keepalive is now
  enabled, helping graceful recovery from unclean network
  disconnections.
- XenCPU plugin: This new plugin collects XEN Hypervisor CPU
  stats.
- ZFS ARC plugin: Several new statistics have been added and a
  couple of obsolete ones removed.
- Zone plugin: This new plugin reads per-zone CPU usage on
  Solaris.

Version 5.5.2
- collectd: A division by zero has been fixed in the
  plugin_dispatch_multivalue() function.
- collectd: The address of the Free Software Foundation has been
  fixed in GPL license headers.
- Build system: Detection and handling of librrd 1.6 and later has
  been fixed.
- Apache plugin: A warning about a possible misconfiguration has
  been added.
- cURL, cURL-JSON and cURL-XML plugins: A memory leak when
  allocating more memory fails has been fixed.
- DF plugin: A build issue on DragonFlyBSD has been fixed.
- Ethstat plugin: Code to strip leading whitespace from device
  names. This works around an issue in the VMXNet3 driver.
- Exec plugin: A problem in the error handling of an fdopen()
  failure has been fixed.
- Modbus plugin: The debug output has been disabled by default. It
  is now only enabled when building with --enable-debug.
- Network plugin: A check for the initialization of secure memory
  has been added. Previously, failure to initialize this memory
  was ignored.
- Network plugin: A heap overflow has been fixed in the server
  code. This issue can be triggered remotely and is potentially
  exploitable.
- Perl plugin: Init callbacks have been changed to run essentially
  single-threaded to avoid race conditions by init functions which
  create additional threads.
- Processes plugin: A compilation error on systems without regex.h
  has been fixed.
- Processes plugin: A memory leak on Solaris has been fixed.
- Processes plugin: A warning about too long process names has
  been added.
- Redis plugin: A memory leak in an error handling code path has
  been fixed.
- Redis plugin: The data source type of the expired_keys metric
  has been corrected to DERIVE.
- SMART plugin: A build dependency on libudev has been added.
- StatsD plugin: A deadlock on plugin shutdown has been fixed.
- Write HTTP plugin: Freeing of memory holding HTTP headers during
  shutdown has been fixed.
- Write Sensu plugin: A segfault when the Tag was unset has been
  fixed.
- ZFS ARC plugin: The cache_operation-stolen metric has been
  removed for FreeBSD 10.2 and later.

$NetBSD: patch-src_cpu.c,v 1.2 2016/10/13 15:17:28 fhajny Exp $

Port this too to NetBSD.

--- src/cpu.c.orig	2016-09-11 08:10:25.255038733 +0000
+++ src/cpu.c
@@ -80,7 +80,9 @@
 
 #if HAVE_SYSCTL
 # if defined(CTL_HW) && defined(HW_NCPU) \
-	&& defined(CTL_KERN) && defined(KERN_CPTIME) && defined(CPUSTATES)
+	&& defined(CTL_KERN) \
+	&& (defined(KERN_CPTIME) || defined(KERN_CP_TIME)) \
+	&& defined(CPUSTATES)
 #  define CAN_USE_SYSCTL 1
 # else
 #  define CAN_USE_SYSCTL 0
@@ -696,6 +698,24 @@ static int cpu_read (void)
 
 	memset (cpuinfo, 0, sizeof (cpuinfo));
 
+#if defined(KERN_CP_TIME) && defined(KERNEL_NETBSD)
+       {
+               int mib[] = {CTL_KERN, KERN_CP_TIME};
+
+               cpuinfo_size = sizeof(cpuinfo[0]) * numcpu * CPUSTATES;
+               status = sysctl(mib, 2, cpuinfo, &cpuinfo_size, NULL, 0);
+               if (status == -1) {
+                       char errbuf[1024];
+
+                       ERROR ("cpu plugin: sysctl failed: %s.",
+                              sstrerror (errno, errbuf, sizeof (errbuf)));
+                       return -1;
+               }
+               if (cpuinfo_size == (sizeof(cpuinfo[0]) * CPUSTATES)) {
+                       numcpu = 1;
+               }
+       }
+#else /* defined(KERN_CP_TIME) && defined(KERNEL_NETBSD) */
 #if defined(KERN_CPTIME2)
 	if (numcpu > 1) {
 		for (int i = 0; i < numcpu; i++) {
@@ -735,6 +755,7 @@ static int cpu_read (void)
 			cpuinfo[0][i] = cpuinfo_tmp[i];
 		}
 	}
+#endif /* defined(KERN_CP_TIME) && defined(KERNEL_NETBSD) */
 
 	for (int i = 0; i < numcpu; i++) {
 		cpu_stage (i, COLLECTD_CPU_STATE_USER,      (derive_t) cpuinfo[i][CP_USER], now);