Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package telegraf for openSUSE:Factory checked in at 2021-04-08 21:32:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/telegraf (Old) and /work/SRC/openSUSE:Factory/.telegraf.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "telegraf" Thu Apr 8 21:32:19 2021 rev:7 rq:883695 version:1.18.1 Changes: -------- --- /work/SRC/openSUSE:Factory/telegraf/telegraf.changes 2021-03-30 21:21:42.593973744 +0200 +++ /work/SRC/openSUSE:Factory/.telegraf.new.2401/telegraf.changes 2021-04-08 21:32:26.655825479 +0200 @@ -1,0 +2,22 @@ +Wed Apr 07 21:36:28 UTC 2021 - jkowalc...@suse.com + +- Update to version 1.18.1: + * Add ability to handle 'binary logs' mySQL query with 3 columns, in case 3 columns are sent (MySQL 8 and greater) (#9082) + * Add configurable option for the 'path' tag override in the Tail plugin. (#9069) + * fix nfsclient merge to release-1.18 branch + * inputs.nfsclient: use uint64, also update error handling (#9067) + * Fix inputs.snmp init when no mibs installed (#9050) + * inputs.ping: Always SetPrivileged(true) in native mode (#9072) + * Don't walk the entire interface table to just retrieve one field (#9043) + * readme fix (#9064) + * use correct compute metadata url to get folder-id (#9056) + * Handle error when initializing the auth object in Azure Monitor output plugin. (#9048) + * update: inputs.sqlserver support version in readme (#9040) + * SQLServer - Fixes sqlserver_process_cpu calculation (#8549) + * Fix ipmi panic (#9035) + * check for length of perusage for stat gathering and removed not used function (#9009) + * update new plugins in changelog (#8991) + * exec plugins should not truncate messages in debug mode (#8333) + * Close running outputs when reloading (#8769) + +------------------------------------------------------------------- Old: ---- telegraf-1.18.0.tar.gz New: ---- telegraf-1.18.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ telegraf.spec ++++++ --- /var/tmp/diff_new_pack.Y0fznw/_old 2021-04-08 21:32:28.315827301 +0200 +++ /var/tmp/diff_new_pack.Y0fznw/_new 2021-04-08 21:32:28.319827305 +0200 @@ -18,7 +18,7 @@ %define _config_dir %{_sysconfdir}/%{name} Name: telegraf -Version: 1.18.0 +Version: 1.18.1 Release: 0 Summary: The plugin-driven server agent for collecting & reporting metrics License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.Y0fznw/_old 2021-04-08 21:32:28.355827345 +0200 +++ /var/tmp/diff_new_pack.Y0fznw/_new 2021-04-08 21:32:28.355827345 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/influxdata/telegraf</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v1.18.0</param> + <param name="revision">v1.18.1</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.Y0fznw/_old 2021-04-08 21:32:28.375827367 +0200 +++ /var/tmp/diff_new_pack.Y0fznw/_new 2021-04-08 21:32:28.379827371 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/influxdata/telegraf</param> - <param name="changesrevision">0d0f78da00ac25d8286457802bd739e6b6c61052</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">dc4fa5dd9aa5876b6ba5022aab3d5453fecc7b2b</param></service></servicedata> \ No newline at end of file ++++++ telegraf-1.18.0.tar.gz -> telegraf-1.18.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/CHANGELOG.md new/telegraf-1.18.1/CHANGELOG.md --- old/telegraf-1.18.0/CHANGELOG.md 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/CHANGELOG.md 2021-04-07 21:19:51.000000000 +0200 @@ -1,3 +1,21 @@ +## v1.18.1 [2021-04-07] + +#### Bugfixes + + - [#9082](https://github.com/influxdata/telegraf/pull/9082) `inputs.mysql` Fix 'binary logs' query for MySQL 8 + - [#9069](https://github.com/influxdata/telegraf/pull/9069) `inputs.tail` Add configurable option for the 'path' tag override + - [#9067](https://github.com/influxdata/telegraf/pull/9067) `inputs.nfsclient` Fix integer overflow in fields from mountstat + - [#9050](https://github.com/influxdata/telegraf/pull/9050) `inputs.snmp` Fix init when no mibs are installed + - [#9072](https://github.com/influxdata/telegraf/pull/9072) `inputs.ping` Always call SetPrivileged(true) in native mode + - [#9043](https://github.com/influxdata/telegraf/pull/9043) `processors.ifname` Get interface name more effeciently + - [#9056](https://github.com/influxdata/telegraf/pull/9056) `outputs.yandex_cloud_monitoring` Use correct compute metadata URL to get folder-id + - [#9048](https://github.com/influxdata/telegraf/pull/9048) `outputs.azure_monitor` Handle error when initializing the auth object + - [#8549](https://github.com/influxdata/telegraf/pull/8549) `inputs.sqlserver` Fix sqlserver_process_cpu calculation + - [#9035](https://github.com/influxdata/telegraf/pull/9035) `inputs.ipmi_sensor` Fix panic + - [#9009](https://github.com/influxdata/telegraf/pull/9009) `inputs.docker` Fix panic when parsing container stats + - [#8333](https://github.com/influxdata/telegraf/pull/8333) `inputs.exec` Don't truncate messages in debug mode + - [#8769](https://github.com/influxdata/telegraf/pull/8769) `agent` Close running outputs when reloadinlg + ## v1.18.0 [2021-03-17] #### Release Notes @@ -30,7 +48,6 @@ - [#8887](https://github.com/influxdata/telegraf/pull/8887) `inputs.procstat` Add PPID field to procstat input plugin - [#8852](https://github.com/influxdata/telegraf/pull/8852) `processors.starlark` Add Starlark script for estimating Line Protocol cardinality - - [#8828](https://github.com/influxdata/telegraf/pull/8828) `serializers.msgpack` Add MessagePack output data format - [#8915](https://github.com/influxdata/telegraf/pull/8915) `inputs.cloudwatch` add proxy - [#8910](https://github.com/influxdata/telegraf/pull/8910) `agent` Display error message on badly formatted config string array (eg. namepass) - [#8785](https://github.com/influxdata/telegraf/pull/8785) `inputs.diskio` Non systemd support with unittest @@ -48,37 +65,37 @@ - [#8950](https://github.com/influxdata/telegraf/pull/8950) `inputs.teamspeak` Teamspeak input plugin query clients - [#8849](https://github.com/influxdata/telegraf/pull/8849) `inputs.sqlserver` Filter data out from system databases for Azure SQL DB only -#### New Input Plugins - - - [#8834](https://github.com/influxdata/telegraf/pull/8834) Input plugin for RavenDB - - [#8525](https://github.com/influxdata/telegraf/pull/8525) Add CSGO SRCDS input plugin - - [#8751](https://github.com/influxdata/telegraf/pull/8751) Adding a new directory monitor input plugin. - - [#6653](https://github.com/influxdata/telegraf/pull/6653) Add Beat input plugin - - [#4615](https://github.com/influxdata/telegraf/pull/4615) Add NFS client input - - [#8931](https://github.com/influxdata/telegraf/pull/8931) Add XML parser using XPath queries - -#### New Output Plugins - - - [#8398](https://github.com/influxdata/telegraf/pull/8398) Sensu Go Output Plugin for Telegraf - - [#8450](https://github.com/influxdata/telegraf/pull/8450) plugin: output loki - - [#6714](https://github.com/influxdata/telegraf/pull/6714) SignalFx Output - - [#8634](https://github.com/influxdata/telegraf/pull/8634) Bigquery output - -#### New Aggregator Plugins - - - [#3762](https://github.com/influxdata/telegraf/pull/3762) Add Derivative Aggregator Plugin - - [#8594](https://github.com/influxdata/telegraf/pull/8594) Add quantile aggregator plugin - -#### New Processor Plugins - - - [#8707](https://github.com/influxdata/telegraf/pull/8707) AWS EC2 metadata processor Using StreamingProcessor +#### New Inputs + - [Beat Input Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/beat) - Contributed by @nferch + - [CS:GO Input Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/csgo) - Contributed by @oofdog + - [Directory Monitoring Input Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/directory_monitor) - Contributed by @InfluxData + - [RavenDB Input Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ravendb) - Contributed by @ml054 and @bartoncasey + - [NFS Input Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nfsclient) - Contributed by @pmoranga + +#### New Outputs + - [Grafana Loki Output Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/loki) - Contributed by @Eraac + - [Google BigQuery Output Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/loki) - Contributed by @gkatzioura + - [Sensu Output Plugin](https://github.com/influxdata/telegraf/blob/master/plugins/outputs/sensu) - Contributed by @calebhailey + - [SignalFX Output Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/signalfx) - Contributed by @keitwb + +#### New Aggregators + - [Derivative Aggregator Plugin ](https://github.com/influxdata/telegraf/tree/master/plugins/aggregators/derivative)- Contributed by @KarstenSchnitter + - [Quantile Aggregator Plugin ](https://github.com/influxdata/telegraf/tree/master/plugins/aggregators/quantile) - Contributed by @srebhan + +#### New Processors + - [AWS EC2 Metadata Processor Plugin ](https://github.com/influxdata/telegraf/tree/master/plugins/processors/aws/ec2) - Contributed by @pmalek-sumo + +#### New Parsers + - [XML Parser Plugin ](https://github.com/influxdata/telegraf/tree/master/plugins/parsers/xml) - Contributed by @srebhan + +#### New Serializers + - [MessagePack Serializer Plugin](https://github.com/influxdata/telegraf/tree/master/plugins/serializers/msgpack) - Contributed by @dialogbox #### New External Plugins - - - [#8897](https://github.com/influxdata/telegraf/pull/8897) add SMCIPMITool input to external plugin list - - [#8898](https://github.com/influxdata/telegraf/pull/8898) Add Plex Webhooks external plugin - - + - [GeoIP Processor Plugin ](https://github.com/a-bali/telegraf-geoip) - Contributed by @a-bali + - [Plex Webhook Input Plugin](https://github.com/russorat/telegraf-webhooks-plex) - Contributed by @russorat + - [SMCIPMITool Input Plugin](https://github.com/jhpope/smc_ipmi) - Contributed by @jhpope + ## v1.17.3 [2021-02-17] #### Bugfixes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/agent/agent.go new/telegraf-1.18.1/agent/agent.go --- old/telegraf-1.18.0/agent/agent.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/agent/agent.go 2021-04-07 21:19:51.000000000 +0200 @@ -447,6 +447,13 @@ } } +// stopRunningOutputs stops all running outputs. +func stopRunningOutputs(outputs []*models.RunningOutput) { + for _, output := range outputs { + output.Close() + } +} + // gather runs an input's gather function periodically until the context is // done. func (a *Agent) gatherLoop( @@ -785,6 +792,9 @@ cancel() wg.Wait() + log.Println("I! [agent] Stopping running outputs") + stopRunningOutputs(unit.outputs) + return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/build_version.txt new/telegraf-1.18.1/build_version.txt --- old/telegraf-1.18.0/build_version.txt 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/build_version.txt 2021-04-07 21:19:51.000000000 +0200 @@ -1 +1 @@ -1.18.0 +1.18.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/cmd/telegraf/telegraf.go new/telegraf-1.18.1/cmd/telegraf/telegraf.go --- old/telegraf-1.18.0/cmd/telegraf/telegraf.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/cmd/telegraf/telegraf.go 2021-04-07 21:19:51.000000000 +0200 @@ -15,6 +15,7 @@ "syscall" "time" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/agent" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/internal" @@ -158,8 +159,9 @@ } // Setup logging as configured. + telegraf.Debug = ag.Config.Agent.Debug || *fDebug logConfig := logger.LogConfig{ - Debug: ag.Config.Agent.Debug || *fDebug, + Debug: telegraf.Debug, Quiet: ag.Config.Agent.Quiet || *fQuiet, LogTarget: ag.Config.Agent.LogTarget, Logfile: ag.Config.Agent.Logfile, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/etc/telegraf.conf new/telegraf-1.18.1/etc/telegraf.conf --- old/telegraf-1.18.0/etc/telegraf.conf 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/etc/telegraf.conf 2021-04-07 21:19:51.000000000 +0200 @@ -5151,7 +5151,7 @@ # # timeout = "5ms" -# # A plugin to collect stats from Opensmtpd - a validating, recursive, and caching DNS resolver +# # A plugin to collect stats from Opensmtpd - a validating, recursive, and caching DNS resolver # [[inputs.opensmtpd]] # ## If running as a restricted user you can prepend sudo for additional access: # #use_sudo = false @@ -6979,7 +6979,7 @@ # ## This value is propagated to pqos tool. Interval format is defined by pqos itself. # ## If not provided or provided 0, will be set to 10 = 10x100ms = 1s. # # sampling_interval = "10" -# +# # ## Optionally specify the path to pqos executable. # ## If not provided, auto discovery will be performed. # # pqos_path = "/usr/local/bin/pqos" @@ -6987,12 +6987,12 @@ # ## Optionally specify if IPC and LLC_Misses metrics shouldn't be propagated. # ## If not provided, default value is false. # # shortened_metrics = false -# +# # ## Specify the list of groups of CPU core(s) to be provided as pqos input. # ## Mandatory if processes aren't set and forbidden if processes are specified. # ## e.g. ["0-3", "4,5,6"] or ["1-3,4"] # # cores = ["0-3"] -# +# # ## Specify the list of processes for which Metrics will be collected. # ## Mandatory if cores aren't set and forbidden if cores are specified. # ## e.g. ["qemu", "pmd"] @@ -7944,6 +7944,9 @@ # ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md # data_format = "influx" # +# ## Set the tag that will contain the path of the tailed file. If you don't want this tag, set it to an empty string. +# # path_tag = "path" +# # ## multiline parser/codec # ## https://www.elastic.co/guide/en/logstash/2.4/plugins-filters-multiline.html # #[inputs.tail.multiline] @@ -8189,3 +8192,4 @@ # [[inputs.zipkin]] # # path = "/api/v1/spans" # URL path for span data # # port = 9411 # Port on which Telegraf listens + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugin.go new/telegraf-1.18.1/plugin.go --- old/telegraf-1.18.0/plugin.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugin.go 2021-04-07 21:19:51.000000000 +0200 @@ -1,5 +1,7 @@ package telegraf +var Debug bool + // Initializer is an interface that all plugin types: Inputs, Outputs, // Processors, and Aggregators can optionally implement to initialize the // plugin. @@ -21,7 +23,7 @@ Description() string } -// Logger defines an interface for logging. +// Logger defines an plugin-related interface for logging. type Logger interface { // Errorf logs an error message, patterned after log.Printf. Errorf(format string, args ...interface{}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/docker/docker.go new/telegraf-1.18.1/plugins/inputs/docker/docker.go --- old/telegraf-1.18.0/plugins/inputs/docker/docker.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/docker/docker.go 2021-04-07 21:19:51.000000000 +0200 @@ -734,7 +734,7 @@ acc.AddFields("docker_container_cpu", cpufields, cputags, tm) } - if choice.Contains("cpu", perDeviceInclude) { + if choice.Contains("cpu", perDeviceInclude) && len(stat.CPUStats.CPUUsage.PercpuUsage) > 0 { // If we have OnlineCPUs field, then use it to restrict stats gathering to only Online CPUs // (https://github.com/moby/moby/commit/115f91d7575d6de6c7781a96a082f144fd17e400) var percpuusage []uint64 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/exec/exec.go new/telegraf-1.18.1/plugins/inputs/exec/exec.go --- old/telegraf-1.18.0/plugins/inputs/exec/exec.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/exec/exec.go 2021-04-07 21:19:51.000000000 +0200 @@ -3,6 +3,7 @@ import ( "bytes" "fmt" + "io" "os/exec" "path/filepath" "runtime" @@ -39,12 +40,12 @@ data_format = "influx" ` -const MaxStderrBytes = 512 +const MaxStderrBytes int = 512 type Exec struct { - Commands []string - Command string - Timeout internal.Duration + Commands []string `toml:"commands"` + Command string `toml:"command"` + Timeout internal.Duration `toml:"timeout"` parser parsers.Parser @@ -85,16 +86,16 @@ runErr := internal.RunTimeout(cmd, timeout) - out = removeCarriageReturns(out) - if stderr.Len() > 0 { - stderr = removeCarriageReturns(stderr) - stderr = truncate(stderr) + out = removeWindowsCarriageReturns(out) + if stderr.Len() > 0 && !telegraf.Debug { + stderr = removeWindowsCarriageReturns(stderr) + stderr = c.truncate(stderr) } return out.Bytes(), stderr.Bytes(), runErr } -func truncate(buf bytes.Buffer) bytes.Buffer { +func (c CommandRunner) truncate(buf bytes.Buffer) bytes.Buffer { // Limit the number of bytes. didTruncate := false if buf.Len() > MaxStderrBytes { @@ -114,27 +115,21 @@ return buf } -// removeCarriageReturns removes all carriage returns from the input if the +// removeWindowsCarriageReturns removes all carriage returns from the input if the // OS is Windows. It does not return any errors. -func removeCarriageReturns(b bytes.Buffer) bytes.Buffer { +func removeWindowsCarriageReturns(b bytes.Buffer) bytes.Buffer { if runtime.GOOS == "windows" { var buf bytes.Buffer for { - byt, er := b.ReadBytes(0x0D) - end := len(byt) - if nil == er { - end-- + byt, err := b.ReadBytes(0x0D) + byt = bytes.TrimRight(byt, "\x0d") + if len(byt) > 0 { + _, _ = buf.Write(byt) } - if nil != byt { - buf.Write(byt[:end]) - } else { - break - } - if nil != er { - break + if err == io.EOF { + return buf } } - b = buf } return b diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/exec/exec_test.go new/telegraf-1.18.1/plugins/inputs/exec/exec_test.go --- old/telegraf-1.18.0/plugins/inputs/exec/exec_test.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/exec/exec_test.go 2021-04-07 21:19:51.000000000 +0200 @@ -259,9 +259,10 @@ }, } + c := CommandRunner{} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - res := truncate(*tt.bufF()) + res := c.truncate(*tt.bufF()) require.Equal(t, tt.expF().Bytes(), res.Bytes()) }) } @@ -272,14 +273,14 @@ // Test that all carriage returns are removed for _, test := range crTests { b := bytes.NewBuffer(test.input) - out := removeCarriageReturns(*b) + out := removeWindowsCarriageReturns(*b) assert.True(t, bytes.Equal(test.output, out.Bytes())) } } else { // Test that the buffer is returned unaltered for _, test := range crTests { b := bytes.NewBuffer(test.input) - out := removeCarriageReturns(*b) + out := removeWindowsCarriageReturns(*b) assert.True(t, bytes.Equal(test.input, out.Bytes())) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/ipmi_sensor/connection.go new/telegraf-1.18.1/plugins/inputs/ipmi_sensor/connection.go --- old/telegraf-1.18.0/plugins/inputs/ipmi_sensor/connection.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/ipmi_sensor/connection.go 2021-04-07 21:19:51.000000000 +0200 @@ -32,8 +32,10 @@ security := server[0:inx1] connstr = server[inx1+1:] up := strings.SplitN(security, ":", 2) - conn.Username = up[0] - conn.Password = up[1] + if len(up) == 2 { + conn.Username = up[0] + conn.Password = up[1] + } } if inx2 > 0 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/ipmi_sensor/connection_test.go new/telegraf-1.18.1/plugins/inputs/ipmi_sensor/connection_test.go --- old/telegraf-1.18.0/plugins/inputs/ipmi_sensor/connection_test.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/ipmi_sensor/connection_test.go 2021-04-07 21:19:51.000000000 +0200 @@ -38,6 +38,18 @@ HexKey: "0001", }, }, + // test connection doesn't panic if incorrect symbol used + { + "USERID@PASSW0RD@lan(192.168.1.1)", + &Connection{ + Hostname: "192.168.1.1", + Username: "", + Password: "", + Interface: "lan", + Privilege: "USER", + HexKey: "0001", + }, + }, } for _, v := range testData { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/mysql/mysql.go new/telegraf-1.18.1/plugins/inputs/mysql/mysql.go --- old/telegraf-1.18.0/plugins/inputs/mysql/mysql.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/mysql/mysql.go 2021-04-07 21:19:51.000000000 +0200 @@ -13,8 +13,8 @@ "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/common/tls" "github.com/influxdata/telegraf/plugins/inputs" - "github.com/influxdata/telegraf/plugins/inputs/mysql/v1" - "github.com/influxdata/telegraf/plugins/inputs/mysql/v2" + v1 "github.com/influxdata/telegraf/plugins/inputs/mysql/v1" + v2 "github.com/influxdata/telegraf/plugins/inputs/mysql/v2" ) type Mysql struct { @@ -711,17 +711,31 @@ servtag := getDSNTag(serv) tags := map[string]string{"server": servtag} var ( - size uint64 - count uint64 - fileSize uint64 - fileName string + size uint64 + count uint64 + fileSize uint64 + fileName string + encrypted string ) + columns, err := rows.Columns() + if err != nil { + return err + } + numColumns := len(columns) + // iterate over rows and count the size and count of files for rows.Next() { - if err := rows.Scan(&fileName, &fileSize); err != nil { - return err + if numColumns == 3 { + if err := rows.Scan(&fileName, &fileSize, &encrypted); err != nil { + return err + } + } else { + if err := rows.Scan(&fileName, &fileSize); err != nil { + return err + } } + size += fileSize count++ } @@ -729,6 +743,7 @@ "binary_size_bytes": size, "binary_files_count": count, } + acc.AddFields("mysql", fields, tags) return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/nfsclient/nfsclient.go new/telegraf-1.18.1/plugins/inputs/nfsclient/nfsclient.go --- old/telegraf-1.18.0/plugins/inputs/nfsclient/nfsclient.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/nfsclient/nfsclient.go 2021-04-07 21:19:51.000000000 +0200 @@ -2,7 +2,7 @@ import ( "bufio" - "log" + "fmt" "os" "regexp" "strconv" @@ -61,41 +61,44 @@ return "Read per-mount NFS client metrics from /proc/self/mountstats" } -func convertToInt64(line []string) []int64 { +func convertToUint64(line []string) ([]uint64, error) { /* A "line" of input data (a pre-split array of strings) is processed one field at a time. Each field is converted to - an int64 value, and appened to an array of return values. - On an error, check for ErrRange, and throw a fatal error + an uint64 value, and appened to an array of return values. + On an error, check for ErrRange, and returns an error if found. This situation indicates a pretty major issue in the /proc/self/mountstats file, and returning faulty data is worse than no data. Other errors are ignored, and append whatever we got in the first place (probably 0). Yes, this is ugly. */ - var nline []int64 + var nline []uint64 if len(line) < 2 { - return nline + return nline, nil } // Skip the first field; it's handled specially as the "first" variable for _, l := range line[1:] { - val, err := strconv.ParseInt(l, 10, 64) + val, err := strconv.ParseUint(l, 10, 64) if err != nil { if numError, ok := err.(*strconv.NumError); ok { if numError.Err == strconv.ErrRange { - log.Fatalf("ErrRange: line:[%v] raw:[%v] -> parsed:[%v]\n", line, l, val) + return nil, fmt.Errorf("errrange: line:[%v] raw:[%v] -> parsed:[%v]", line, l, val) } } } nline = append(nline, val) } - return nline + return nline, nil } -func (n *NFSClient) parseStat(mountpoint string, export string, version string, line []string, fullstat bool, acc telegraf.Accumulator) error { +func (n *NFSClient) parseStat(mountpoint string, export string, version string, line []string, acc telegraf.Accumulator) error { tags := map[string]string{"mountpoint": mountpoint, "serverexport": export} - nline := convertToInt64(line) + nline, err := convertToUint64(line) + if err != nil { + return err + } if len(nline) == 0 { n.Log.Warnf("Parsing Stat line with one field: %s\n", line) @@ -191,7 +194,7 @@ acc.AddFields("nfsstat", fields, tags) } - if fullstat { + if n.Fullstat { switch first { case "events": if len(nline) >= len(eventsFields) { @@ -297,9 +300,13 @@ } if !skip { - n.parseStat(mount, export, version, line, n.Fullstat, acc) + err := n.parseStat(mount, export, version, line, acc) + if err != nil { + return fmt.Errorf("could not parseStat: %w", err) + } } } + return nil } @@ -323,7 +330,10 @@ defer file.Close() scanner := bufio.NewScanner(file) - n.processText(scanner, acc) + err = n.processText(scanner, acc) + if err != nil { + return err + } if err := scanner.Err(); err != nil { n.Log.Errorf("%s", err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/nfsclient/nfsclient_test.go new/telegraf-1.18.1/plugins/inputs/nfsclient/nfsclient_test.go --- old/telegraf-1.18.0/plugins/inputs/nfsclient/nfsclient_test.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/nfsclient/nfsclient_test.go 2021-04-07 21:19:51.000000000 +0200 @@ -2,10 +2,12 @@ import ( "bufio" - "github.com/influxdata/telegraf/testutil" "os" "strings" "testing" + + "github.com/influxdata/telegraf/testutil" + "github.com/stretchr/testify/require" ) func getMountStatsPath() string { @@ -21,45 +23,70 @@ func TestNFSClientParsev3(t *testing.T) { var acc testutil.Accumulator - nfsclient := NFSClient{} + nfsclient := NFSClient{Fullstat: true} nfsclient.nfs3Ops = map[string]bool{"READLINK": true, "GETATTR": false} nfsclient.nfs4Ops = map[string]bool{"READLINK": true, "GETATTR": false} data := strings.Fields(" READLINK: 500 501 502 503 504 505 506 507") - nfsclient.parseStat("1.2.3.4:/storage/NFS", "/A", "3", data, true, &acc) + err := nfsclient.parseStat("1.2.3.4:/storage/NFS", "/A", "3", data, &acc) + require.NoError(t, err) - fields_ops := map[string]interface{}{ - "ops": int64(500), - "trans": int64(501), - "timeouts": int64(502), - "bytes_sent": int64(503), - "bytes_recv": int64(504), - "queue_time": int64(505), - "response_time": int64(506), - "total_time": int64(507), + fieldsOps := map[string]interface{}{ + "ops": uint64(500), + "trans": uint64(501), + "timeouts": uint64(502), + "bytes_sent": uint64(503), + "bytes_recv": uint64(504), + "queue_time": uint64(505), + "response_time": uint64(506), + "total_time": uint64(507), } - acc.AssertContainsFields(t, "nfs_ops", fields_ops) + acc.AssertContainsFields(t, "nfs_ops", fieldsOps) } func TestNFSClientParsev4(t *testing.T) { var acc testutil.Accumulator - nfsclient := NFSClient{} + nfsclient := NFSClient{Fullstat: true} nfsclient.nfs3Ops = map[string]bool{"DESTROY_SESSION": true, "GETATTR": false} nfsclient.nfs4Ops = map[string]bool{"DESTROY_SESSION": true, "GETATTR": false} data := strings.Fields(" DESTROY_SESSION: 500 501 502 503 504 505 506 507") - nfsclient.parseStat("2.2.2.2:/nfsdata/", "/B", "4", data, true, &acc) + err := nfsclient.parseStat("2.2.2.2:/nfsdata/", "/B", "4", data, &acc) + require.NoError(t, err) + + fieldsOps := map[string]interface{}{ + "ops": uint64(500), + "trans": uint64(501), + "timeouts": uint64(502), + "bytes_sent": uint64(503), + "bytes_recv": uint64(504), + "queue_time": uint64(505), + "response_time": uint64(506), + "total_time": uint64(507), + } + acc.AssertContainsFields(t, "nfs_ops", fieldsOps) +} + +func TestNFSClientParseLargeValue(t *testing.T) { + var acc testutil.Accumulator - fields_ops := map[string]interface{}{ - "ops": int64(500), - "trans": int64(501), - "timeouts": int64(502), - "bytes_sent": int64(503), - "bytes_recv": int64(504), - "queue_time": int64(505), - "response_time": int64(506), - "total_time": int64(507), + nfsclient := NFSClient{Fullstat: true} + nfsclient.nfs3Ops = map[string]bool{"SETCLIENTID": true, "GETATTR": false} + nfsclient.nfs4Ops = map[string]bool{"SETCLIENTID": true, "GETATTR": false} + data := strings.Fields(" SETCLIENTID: 218 216 0 53568 12960 18446744073709531008 134 197") + err := nfsclient.parseStat("2.2.2.2:/nfsdata/", "/B", "4", data, &acc) + require.NoError(t, err) + + fieldsOps := map[string]interface{}{ + "ops": uint64(218), + "trans": uint64(216), + "timeouts": uint64(0), + "bytes_sent": uint64(53568), + "bytes_recv": uint64(12960), + "queue_time": uint64(18446744073709531008), + "response_time": uint64(134), + "total_time": uint64(197), } - acc.AssertContainsFields(t, "nfs_ops", fields_ops) + acc.AssertContainsFields(t, "nfs_ops", fieldsOps) } func TestNFSClientProcessStat(t *testing.T) { @@ -73,14 +100,15 @@ scanner := bufio.NewScanner(file) - nfsclient.processText(scanner, &acc) + err := nfsclient.processText(scanner, &acc) + require.NoError(t, err) - fields_readstat := map[string]interface{}{ - "ops": int64(600), - "retrans": int64(1), - "bytes": int64(1207), - "rtt": int64(606), - "exe": int64(607), + fieldsReadstat := map[string]interface{}{ + "ops": uint64(600), + "retrans": uint64(1), + "bytes": uint64(1207), + "rtt": uint64(606), + "exe": uint64(607), } read_tags := map[string]string{ @@ -89,14 +117,14 @@ "operation": "READ", } - acc.AssertContainsTaggedFields(t, "nfsstat", fields_readstat, read_tags) + acc.AssertContainsTaggedFields(t, "nfsstat", fieldsReadstat, read_tags) - fields_writestat := map[string]interface{}{ - "ops": int64(700), - "retrans": int64(1), - "bytes": int64(1407), - "rtt": int64(706), - "exe": int64(707), + fieldsWritestat := map[string]interface{}{ + "ops": uint64(700), + "retrans": uint64(1), + "bytes": uint64(1407), + "rtt": uint64(706), + "exe": uint64(707), } write_tags := map[string]string{ @@ -104,7 +132,7 @@ "mountpoint": "/A", "operation": "WRITE", } - acc.AssertContainsTaggedFields(t, "nfsstat", fields_writestat, write_tags) + acc.AssertContainsTaggedFields(t, "nfsstat", fieldsWritestat, write_tags) } func TestNFSClientProcessFull(t *testing.T) { @@ -118,60 +146,61 @@ scanner := bufio.NewScanner(file) - nfsclient.processText(scanner, &acc) + err := nfsclient.processText(scanner, &acc) + require.NoError(t, err) - fields_events := map[string]interface{}{ - "inoderevalidates": int64(301736), - "dentryrevalidates": int64(22838), - "datainvalidates": int64(410979), - "attrinvalidates": int64(26188427), - "vfsopen": int64(27525), - "vfslookup": int64(9140), - "vfsaccess": int64(114420), - "vfsupdatepage": int64(30785253), - "vfsreadpage": int64(5308856), - "vfsreadpages": int64(5364858), - "vfswritepage": int64(30784819), - "vfswritepages": int64(79832668), - "vfsgetdents": int64(170), - "vfssetattr": int64(64), - "vfsflush": int64(18194), - "vfsfsync": int64(29294718), - "vfslock": int64(0), - "vfsrelease": int64(18279), - "congestionwait": int64(0), - "setattrtrunc": int64(2), - "extendwrite": int64(785551), - "sillyrenames": int64(0), - "shortreads": int64(0), - "shortwrites": int64(0), - "delay": int64(0), - "pnfsreads": int64(0), - "pnfswrites": int64(0), - } - fields_bytes := map[string]interface{}{ - "normalreadbytes": int64(204440464584), - "normalwritebytes": int64(110857586443), - "directreadbytes": int64(783170354688), - "directwritebytes": int64(296174954496), - "serverreadbytes": int64(1134399088816), - "serverwritebytes": int64(407107155723), - "readpages": int64(85749323), - "writepages": int64(30784819), - } - fields_xprt_tcp := map[string]interface{}{ - "bind_count": int64(1), - "connect_count": int64(1), - "connect_time": int64(0), - "idle_time": int64(0), - "rpcsends": int64(96172963), - "rpcreceives": int64(96172963), - "badxids": int64(0), - "inflightsends": int64(620878754), - "backlogutil": int64(0), - } - - acc.AssertContainsFields(t, "nfs_events", fields_events) - acc.AssertContainsFields(t, "nfs_bytes", fields_bytes) - acc.AssertContainsFields(t, "nfs_xprt_tcp", fields_xprt_tcp) + fieldsEvents := map[string]interface{}{ + "inoderevalidates": uint64(301736), + "dentryrevalidates": uint64(22838), + "datainvalidates": uint64(410979), + "attrinvalidates": uint64(26188427), + "vfsopen": uint64(27525), + "vfslookup": uint64(9140), + "vfsaccess": uint64(114420), + "vfsupdatepage": uint64(30785253), + "vfsreadpage": uint64(5308856), + "vfsreadpages": uint64(5364858), + "vfswritepage": uint64(30784819), + "vfswritepages": uint64(79832668), + "vfsgetdents": uint64(170), + "vfssetattr": uint64(64), + "vfsflush": uint64(18194), + "vfsfsync": uint64(29294718), + "vfslock": uint64(0), + "vfsrelease": uint64(18279), + "congestionwait": uint64(0), + "setattrtrunc": uint64(2), + "extendwrite": uint64(785551), + "sillyrenames": uint64(0), + "shortreads": uint64(0), + "shortwrites": uint64(0), + "delay": uint64(0), + "pnfsreads": uint64(0), + "pnfswrites": uint64(0), + } + fieldsBytes := map[string]interface{}{ + "normalreadbytes": uint64(204440464584), + "normalwritebytes": uint64(110857586443), + "directreadbytes": uint64(783170354688), + "directwritebytes": uint64(296174954496), + "serverreadbytes": uint64(1134399088816), + "serverwritebytes": uint64(407107155723), + "readpages": uint64(85749323), + "writepages": uint64(30784819), + } + fieldsXprtTCP := map[string]interface{}{ + "bind_count": uint64(1), + "connect_count": uint64(1), + "connect_time": uint64(0), + "idle_time": uint64(0), + "rpcsends": uint64(96172963), + "rpcreceives": uint64(96172963), + "badxids": uint64(0), + "inflightsends": uint64(620878754), + "backlogutil": uint64(0), + } + + acc.AssertContainsFields(t, "nfs_events", fieldsEvents) + acc.AssertContainsFields(t, "nfs_bytes", fieldsBytes) + acc.AssertContainsFields(t, "nfs_xprt_tcp", fieldsXprtTCP) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/ping/README.md new/telegraf-1.18.1/plugins/inputs/ping/README.md --- old/telegraf-1.18.0/plugins/inputs/ping/README.md 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/ping/README.md 2021-04-07 21:19:51.000000000 +0200 @@ -102,7 +102,7 @@ #### Linux Permissions When using `method = "native"`, Telegraf will attempt to use privileged raw -ICMP sockets. On most systems, doing so requires `CAP_NET_RAW` capabilities. +ICMP sockets. On most systems, doing so requires `CAP_NET_RAW` capabilities or for Telegraf to be run as root. With systemd: ```sh @@ -127,16 +127,9 @@ [man 7 capabilities]: http://man7.org/linux/man-pages/man7/capabilities.7.html -On Linux the default behaviour is to restrict creation of ping sockets for everybody. Execute the below command to enable creation of ping sockets for all possible user groups. The integers provided to ping_group_range defines the range of user groups that are permited to create ping sockets, were 2147483647 (the max of a signed int 2^31) is the max group identifier (GID). +#### Other OS Permissions -```sh -$ sudo sysctl -w net.ipv4.ping_group_range="0 2147483647" -``` - -Reference [`man 7 icmp`][man 7 icmp] for more information about ICMP echo -sockets and the `ping_group_range` setting. - -[man 7 icmp]: http://man7.org/linux/man-pages/man7/icmp.7.html +When using `method = "native"`, you will need permissions similar to the executable ping program for your OS. ### Metrics diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/ping/ping.go new/telegraf-1.18.1/plugins/inputs/ping/ping.go --- old/telegraf-1.18.0/plugins/inputs/ping/ping.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/ping/ping.go 2021-04-07 21:19:51.000000000 +0200 @@ -166,10 +166,7 @@ return nil, fmt.Errorf("failed to create new pinger: %w", err) } - // Required for windows. Despite the method name, this should work without the need to elevate privileges and has been tested on Windows 10 - if runtime.GOOS == "windows" { - pinger.SetPrivileged(true) - } + pinger.SetPrivileged(true) if p.IPv6 { pinger.SetNetwork("ip6") @@ -193,7 +190,14 @@ pinger.Count = p.Count err = pinger.Run() if err != nil { - return nil, fmt.Errorf("failed to run pinger: %w", err) + if strings.Contains(err.Error(), "operation not permitted") { + if runtime.GOOS == "linux" { + return nil, fmt.Errorf("permission changes required, enable CAP_NET_RAW capabilities (refer to the ping plugin's README.md for more info)") + } + + return nil, fmt.Errorf("permission changes required, refer to the ping plugin's README.md for more info") + } + return nil, fmt.Errorf("%w", err) } ps.Statistics = *pinger.Statistics() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/snmp/snmp.go new/telegraf-1.18.1/plugins/inputs/snmp/snmp.go --- old/telegraf-1.18.0/plugins/inputs/snmp/snmp.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/snmp/snmp.go 2021-04-07 21:19:51.000000000 +0200 @@ -255,19 +255,21 @@ return nil } - _, oidNum, oidText, conversion, err := SnmpTranslate(f.Oid) - if err != nil { - return fmt.Errorf("translating: %w", err) + // check if oid needs translation or name is not set + if strings.ContainsAny(f.Oid, ":abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") || f.Name == "" { + _, oidNum, oidText, conversion, err := SnmpTranslate(f.Oid) + if err != nil { + return fmt.Errorf("translating: %w", err) + } + f.Oid = oidNum + if f.Name == "" { + f.Name = oidText + } + if f.Conversion == "" { + f.Conversion = conversion + } + //TODO use textual convention conversion from the MIB } - f.Oid = oidNum - if f.Name == "" { - f.Name = oidText - } - if f.Conversion == "" { - f.Conversion = conversion - } - - //TODO use textual convention conversion from the MIB f.initialized = true return nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/sqlserver/README.md new/telegraf-1.18.1/plugins/inputs/sqlserver/README.md --- old/telegraf-1.18.0/plugins/inputs/sqlserver/README.md 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/sqlserver/README.md 2021-04-07 21:19:51.000000000 +0200 @@ -1,12 +1,12 @@ # SQL Server Input Plugin -The `sqlserver` plugin provides metrics for your SQL Server instance. It -currently works with SQL Server 2008 SP3 and newer. Recorded metrics are +The `sqlserver` plugin provides metrics for your SQL Server instance. Recorded metrics are lightweight and use Dynamic Management Views supplied by SQL Server. ### The SQL Server plugin supports the following editions/versions of SQL Server - SQL Server - - 2008 SP3 (with CU3) - - SQL Server 2008 R2 SP3 and newer versions + - 2012 or newer (Plugin support aligned with the [official Microsoft SQL Server support](https://docs.microsoft.com/en-us/sql/sql-server/end-of-support/sql-server-end-of-life-overview?view=sql-server-ver15#lifecycle-dates)) + - End-of-life SQL Server versions are not guaranteed to be supported by Telegraf. Any issues with the SQL Server plugin for these EOL versions will + need to be addressed by the community. - Azure SQL Database (Single) - Azure SQL Managed Instance diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/sqlserver/sqlqueriesV2.go new/telegraf-1.18.1/plugins/inputs/sqlserver/sqlqueriesV2.go --- old/telegraf-1.18.0/plugins/inputs/sqlserver/sqlqueriesV2.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/sqlserver/sqlqueriesV2.go 2021-04-07 21:19:51.000000000 +0200 @@ -1352,33 +1352,58 @@ /*The ring buffer has a new value every minute*/ IF SERVERPROPERTY('EngineEdition') IN (2,3,4) /*Standard,Enterpris,Express*/ BEGIN -SELECT - 'sqlserver_cpu' AS [measurement] - ,REPLACE(@@SERVERNAME,'\',':') AS [sql_instance] - ,[SQLProcessUtilization] AS [sqlserver_process_cpu] - ,[SystemIdle] AS [system_idle_cpu] - ,100 - [SystemIdle] - [SQLProcessUtilization] AS [other_process_cpu] -FROM ( - SELECT TOP 1 - [record_id] - /*,dateadd(ms, (y.[timestamp] - (SELECT CAST([ms_ticks] AS BIGINT) FROM sys.dm_os_sys_info)), GETDATE()) AS [EventTime] --use for check/debug purpose*/ - ,[SQLProcessUtilization] - ,[SystemIdle] +;WITH utilization_cte AS +( + SELECT + [SQLProcessUtilization] AS [sqlserver_process_cpu] + ,[SystemIdle] AS [system_idle_cpu] + ,100 - [SystemIdle] - [SQLProcessUtilization] AS [other_process_cpu] FROM ( - SELECT record.value('(./Record/@id)[1]', 'int') AS [record_id] - ,record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') AS [SystemIdle] - ,record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') AS [SQLProcessUtilization] - ,[TIMESTAMP] + SELECT TOP 1 + [record_id] + ,[SQLProcessUtilization] + ,[SystemIdle] FROM ( - SELECT [TIMESTAMP] - ,convert(XML, [record]) AS [record] - FROM sys.dm_os_ring_buffers - WHERE [ring_buffer_type] = N'RING_BUFFER_SCHEDULER_MONITOR' - AND [record] LIKE '%<SystemHealth>%' - ) AS x - ) AS y - ORDER BY record_id DESC -) as z + SELECT + record.value('(./Record/@id)[1]', 'int') AS [record_id] + ,record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') AS [SystemIdle] + ,record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') AS [SQLProcessUtilization] + ,[TIMESTAMP] + FROM ( + SELECT + [TIMESTAMP] + ,convert(XML, [record]) AS [record] + FROM sys.dm_os_ring_buffers + WHERE + [ring_buffer_type] = N'RING_BUFFER_SCHEDULER_MONITOR' + AND [record] LIKE '%<SystemHealth>%' + ) AS x + ) AS y + ORDER BY [record_id] DESC + ) AS z +), +processor_Info_cte AS +( + SELECT (cpu_count / hyperthread_ratio) as number_of_physical_cpus + ??FROM sys.dm_os_sys_info +) +SELECT + 'sqlserver_cpu' AS [measurement] + ,REPLACE(@@SERVERNAME,'\',':') AS [sql_instance] + ,[sqlserver_process_cpu] + ,[system_idle_cpu] + ,100 - [system_idle_cpu] - [sqlserver_process_cpu] AS [other_process_cpu] +FROM + ( + SELECT + (case + when [other_process_cpu] < 0 then [sqlserver_process_cpu] / a.number_of_physical_cpus + else [sqlserver_process_cpu] + ??end) as [sqlserver_process_cpu] + ,[system_idle_cpu] + FROM utilization_cte + CROSS APPLY processor_Info_cte a + ) AS b END ` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/sqlserver/sqlserverqueries.go new/telegraf-1.18.1/plugins/inputs/sqlserver/sqlserverqueries.go --- old/telegraf-1.18.0/plugins/inputs/sqlserver/sqlserverqueries.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/sqlserver/sqlserverqueries.go 2021-04-07 21:19:51.000000000 +0200 @@ -1136,37 +1136,60 @@ DECLARE @ErrorMessage AS nvarchar(500) = 'Telegraf - Connection string Server:'+ @@ServerName + ',Database:' + DB_NAME() +' is not a SQL Server Standard,Enterprise or Express. Check the database_type parameter in the telegraf configuration.'; RAISERROR (@ErrorMessage,11,1) RETURN -END +END; -SELECT - 'sqlserver_cpu' AS [measurement] - ,REPLACE(@@SERVERNAME,'\',':') AS [sql_instance] - ,[SQLProcessUtilization] AS [sqlserver_process_cpu] - ,[SystemIdle] AS [system_idle_cpu] - ,100 - [SystemIdle] - [SQLProcessUtilization] AS [other_process_cpu] -FROM ( - SELECT TOP 1 - [record_id] - ,[SQLProcessUtilization] - ,[SystemIdle] +WITH utilization_cte AS +( + SELECT + [SQLProcessUtilization] AS [sqlserver_process_cpu] + ,[SystemIdle] AS [system_idle_cpu] + ,100 - [SystemIdle] - [SQLProcessUtilization] AS [other_process_cpu] FROM ( - SELECT - record.value('(./Record/@id)[1]', 'int') AS [record_id] - ,record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') AS [SystemIdle] - ,record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') AS [SQLProcessUtilization] - ,[TIMESTAMP] + SELECT TOP 1 + [record_id] + ,[SQLProcessUtilization] + ,[SystemIdle] FROM ( SELECT - [TIMESTAMP] - ,convert(XML, [record]) AS [record] - FROM sys.dm_os_ring_buffers - WHERE - [ring_buffer_type] = N'RING_BUFFER_SCHEDULER_MONITOR' - AND [record] LIKE '%<SystemHealth>%' - ) AS x - ) AS y - ORDER BY [record_id] DESC -) AS z + record.value('(./Record/@id)[1]', 'int') AS [record_id] + ,record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') AS [SystemIdle] + ,record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') AS [SQLProcessUtilization] + ,[TIMESTAMP] + FROM ( + SELECT + [TIMESTAMP] + ,convert(XML, [record]) AS [record] + FROM sys.dm_os_ring_buffers + WHERE + [ring_buffer_type] = N'RING_BUFFER_SCHEDULER_MONITOR' + AND [record] LIKE '%<SystemHealth>%' + ) AS x + ) AS y + ORDER BY [record_id] DESC + ) AS z +), +processor_Info_cte AS +( + SELECT (cpu_count / hyperthread_ratio) as number_of_physical_cpus + ??FROM sys.dm_os_sys_info +) +SELECT + 'sqlserver_cpu' AS [measurement] + ,REPLACE(@@SERVERNAME,'\',':') AS [sql_instance] + ,[sqlserver_process_cpu] + ,[system_idle_cpu] + ,100 - [system_idle_cpu] - [sqlserver_process_cpu] AS [other_process_cpu] +FROM + ( + SELECT + (case + when [other_process_cpu] < 0 then [sqlserver_process_cpu] / a.number_of_physical_cpus + else [sqlserver_process_cpu] + ??end) as [sqlserver_process_cpu] + ,[system_idle_cpu] + FROM utilization_cte + CROSS APPLY processor_Info_cte a + ) AS b ` // Collects availability replica state information from `sys.dm_hadr_availability_replica_states` for a High Availability / Disaster Recovery (HADR) setup diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/tail/README.md new/telegraf-1.18.1/plugins/inputs/tail/README.md --- old/telegraf-1.18.0/plugins/inputs/tail/README.md 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/tail/README.md 2021-04-07 21:19:51.000000000 +0200 @@ -64,6 +64,9 @@ ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md data_format = "influx" + ## Set the tag that will contain the path of the tailed file. If you don't want this tag, set it to an empty string. + # path_tag = "path" + ## multiline parser/codec ## https://www.elastic.co/guide/en/logstash/2.4/plugins-filters-multiline.html #[inputs.tail.multiline] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/tail/tail.go new/telegraf-1.18.1/plugins/inputs/tail/tail.go --- old/telegraf-1.18.0/plugins/inputs/tail/tail.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/tail/tail.go 2021-04-07 21:19:51.000000000 +0200 @@ -41,6 +41,7 @@ WatchMethod string `toml:"watch_method"` MaxUndeliveredLines int `toml:"max_undelivered_lines"` CharacterEncoding string `toml:"character_encoding"` + PathTag string `toml:"path_tag"` Log telegraf.Logger `toml:"-"` tailers map[string]*tail.Tail @@ -71,6 +72,7 @@ FromBeginning: false, MaxUndeliveredLines: 1000, offsets: offsetsCopy, + PathTag: "path", } } @@ -116,6 +118,9 @@ ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md data_format = "influx" + ## Set the tag that will contain the path of the tailed file. If you don't want this tag, set it to an empty string. + # path_tag = "path" + ## multiline parser/codec ## https://www.elastic.co/guide/en/logstash/2.4/plugins-filters-multiline.html #[inputs.tail.multiline] @@ -381,8 +386,10 @@ } firstLine = false - for _, metric := range metrics { - metric.AddTag("path", tailer.Filename) + if t.PathTag != "" { + for _, metric := range metrics { + metric.AddTag(t.PathTag, tailer.Filename) + } } // try writing out metric first without blocking diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/inputs/tail/tail_test.go new/telegraf-1.18.1/plugins/inputs/tail/tail_test.go --- old/telegraf-1.18.0/plugins/inputs/tail/tail_test.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/inputs/tail/tail_test.go 2021-04-07 21:19:51.000000000 +0200 @@ -44,6 +44,7 @@ MaxUndeliveredLines: 1000, offsets: offsetsCopy, WatchMethod: watchMethod, + PathTag: "path", } } @@ -357,6 +358,7 @@ plugin.Log = testutil.Logger{} plugin.FromBeginning = true plugin.Files = []string{tmpfile.Name()} + plugin.PathTag = "customPathTagMyFile" plugin.SetParserFunc(func() (parsers.Parser, error) { return json.New( &json.Config{ @@ -379,7 +381,7 @@ expected := []telegraf.Metric{ testutil.MustMetric("cpu", map[string]string{ - "path": tmpfile.Name(), + "customPathTagMyFile": tmpfile.Name(), }, map[string]interface{}{ "time_idle": 42.0, @@ -387,7 +389,7 @@ time.Unix(0, 0)), testutil.MustMetric("cpu", map[string]string{ - "path": tmpfile.Name(), + "customPathTagMyFile": tmpfile.Name(), }, map[string]interface{}{ "time_idle": 42.0, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/outputs/azure_monitor/azure_monitor.go new/telegraf-1.18.1/plugins/outputs/azure_monitor/azure_monitor.go --- old/telegraf-1.18.0/plugins/outputs/azure_monitor/azure_monitor.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/outputs/azure_monitor/azure_monitor.go 2021-04-07 21:19:51.000000000 +0200 @@ -193,7 +193,7 @@ a.auth, err = auth.NewAuthorizerFromEnvironmentWithResource(defaultAuthResource) if err != nil { - return nil + return err } a.Reset() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/outputs/exec/README.md new/telegraf-1.18.1/plugins/outputs/exec/README.md --- old/telegraf-1.18.0/plugins/outputs/exec/README.md 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/outputs/exec/README.md 2021-04-07 21:19:51.000000000 +0200 @@ -8,6 +8,8 @@ On non-zero exit stderr will be logged at error level. +For better performance, consider execd, which runs continuously. + ### Configuration ```toml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/outputs/exec/exec.go new/telegraf-1.18.1/plugins/outputs/exec/exec.go --- old/telegraf-1.18.0/plugins/outputs/exec/exec.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/outputs/exec/exec.go 2021-04-07 21:19:51.000000000 +0200 @@ -6,6 +6,7 @@ "io" "log" "os/exec" + "runtime" "time" "github.com/influxdata/telegraf" @@ -39,6 +40,10 @@ # data_format = "influx" ` +func (e *Exec) Init() error { + return nil +} + // SetSerializer sets the serializer for the output. func (e *Exec) SetSerializer(serializer serializers.Serializer) { e.serializer = serializer @@ -105,8 +110,13 @@ return fmt.Errorf("%q timed out and was killed", command) } + s = removeWindowsCarriageReturns(s) if s.Len() > 0 { - log.Printf("E! [outputs.exec] Command error: %q", truncate(s)) + if !telegraf.Debug { + log.Printf("E! [outputs.exec] Command error: %q", c.truncate(s)) + } else { + log.Printf("D! [outputs.exec] Command error: %q", s) + } } if status, ok := internal.ExitStatus(err); ok { @@ -121,7 +131,7 @@ return nil } -func truncate(buf bytes.Buffer) string { +func (c *CommandRunner) truncate(buf bytes.Buffer) string { // Limit the number of bytes. didTruncate := false if buf.Len() > maxStderrBytes { @@ -149,3 +159,22 @@ } }) } + +// removeWindowsCarriageReturns removes all carriage returns from the input if the +// OS is Windows. It does not return any errors. +func removeWindowsCarriageReturns(b bytes.Buffer) bytes.Buffer { + if runtime.GOOS == "windows" { + var buf bytes.Buffer + for { + byt, err := b.ReadBytes(0x0D) + byt = bytes.TrimRight(byt, "\x0d") + if len(byt) > 0 { + _, _ = buf.Write(byt) + } + if err == io.EOF { + return buf + } + } + } + return b +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/outputs/exec/exec_test.go new/telegraf-1.18.1/plugins/outputs/exec/exec_test.go --- old/telegraf-1.18.0/plugins/outputs/exec/exec_test.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/outputs/exec/exec_test.go 2021-04-07 21:19:51.000000000 +0200 @@ -83,9 +83,10 @@ len: len("hola") + len("..."), }, } + c := CommandRunner{} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s := truncate(*tt.buf) + s := c.truncate(*tt.buf) require.Equal(t, tt.len, len(s)) }) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/outputs/yandex_cloud_monitoring/yandex_cloud_monitoring.go new/telegraf-1.18.1/plugins/outputs/yandex_cloud_monitoring/yandex_cloud_monitoring.go --- old/telegraf-1.18.0/plugins/outputs/yandex_cloud_monitoring/yandex_cloud_monitoring.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/outputs/yandex_cloud_monitoring/yandex_cloud_monitoring.go 2021-04-07 21:19:51.000000000 +0200 @@ -60,7 +60,7 @@ defaultRequestTimeout = time.Second * 20 defaultEndpointURL = "https://monitoring.api.cloud.yandex.net/monitoring/v2/data/write" defaultMetadataTokenURL = "http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token" - defaultMetadataFolderURL = "http://169.254.169.254/computeMetadata/v1/instance/attributes/folder-id" + defaultMetadataFolderURL = "http://169.254.169.254/computeMetadata/v1/yandex/folder-id" ) var sampleConfig = ` @@ -235,6 +235,7 @@ req.Header.Set("Authorization", "Bearer "+a.IAMToken) a.Log.Debugf("sending metrics to %s", req.URL.String()) + a.Log.Debugf("body: %s", body) resp, err := a.client.Do(req) if err != nil { return err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/processors/execd/README.md new/telegraf-1.18.1/plugins/processors/execd/README.md --- old/telegraf-1.18.0/plugins/processors/execd/README.md 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/processors/execd/README.md 2021-04-07 21:19:51.000000000 +0200 @@ -23,7 +23,7 @@ ### Configuration: ```toml -[[processor.execd]] +[[processors.execd]] ## One program to run as daemon. ## NOTE: process and each argument should each be their own string ## eg: command = ["/path/to/your_program", "arg1", "arg2"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telegraf-1.18.0/plugins/processors/ifname/ifname.go new/telegraf-1.18.1/plugins/processors/ifname/ifname.go --- old/telegraf-1.18.0/plugins/processors/ifname/ifname.go 2021-03-17 21:50:00.000000000 +0100 +++ new/telegraf-1.18.1/plugins/processors/ifname/ifname.go 2021-04-07 21:19:51.000000000 +0200 @@ -201,13 +201,13 @@ return fmt.Errorf("parsing SNMP client config: %w", err) } - d.ifTable, err = d.makeTable("IF-MIB::ifTable") + d.ifTable, err = d.makeTable("IF-MIB::ifDescr") if err != nil { - return fmt.Errorf("looking up ifTable in local MIB: %w", err) + return fmt.Errorf("looking up ifDescr in local MIB: %w", err) } - d.ifXTable, err = d.makeTable("IF-MIB::ifXTable") + d.ifXTable, err = d.makeTable("IF-MIB::ifName") if err != nil { - return fmt.Errorf("looking up ifXTable in local MIB: %w", err) + return fmt.Errorf("looking up ifName in local MIB: %w", err) } fn := func(m telegraf.Metric) []telegraf.Metric { @@ -347,11 +347,13 @@ }) } -func makeTableNoMock(tableName string) (*si.Table, error) { +func makeTableNoMock(fieldName string) (*si.Table, error) { var err error tab := si.Table{ - Oid: tableName, IndexAsTag: true, + Fields: []si.Field{ + {Oid: fieldName}, + }, } err = tab.Init() ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/telegraf/vendor.tar.gz /work/SRC/openSUSE:Factory/.telegraf.new.2401/vendor.tar.gz differ: char 5, line 1