Esempio n. 1
0
        private static void SendMetricsWithTcpChannel(string host)
        {
            var uri = new Uri($"tcp://{host}:8095");

            using (var channel = new TcpTelegrafChannel(uri, TimeSpan.FromSeconds(60)))
            {
                //[[outputs.influxdb]]
                //## The value of this tag will be used to determine the database.  If this
                //## tag is not set the 'database' option is used as the default.
                //# database_tag = ""
                // see more https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb
                var defaultTags = new Dictionary <string, string>
                {
                    { "database_tag", "influx_client_tcp_cannel" },
                    { "host", Environment.MachineName }
                };

                var client = new TelegrafInfuxClient(channel, defaultTags);

                client.Send("weather", f => f.Field("temperature", 82), t => t.Tag("location", "us-midwest"), DateTime.Now);
            }
        }
Esempio n. 2
0
        private static void SendMetricsWithTcpChannel(string host)
        {
            var uri = new Uri($"tcp://{host}:8126");

            using (var channel = new TcpTelegrafChannel(uri, TimeSpan.FromSeconds(60)))
            {
                //[[outputs.influxdb]]
                //## The value of this tag will be used to determine the database.  If this
                //## tag is not set the 'database' option is used as the default.
                //# database_tag = ""
                // see more https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb
                var defaultTags = new Dictionary <string, string>
                {
                    { "database_tag", "statsd_client_tcp_cannel" },
                    { "host", Environment.MachineName }
                };

                var client = new TelegrafStatsdClient(channel, defaultTags);

                client.Time("deploys", 200, t => t.Tag("stage", "test").Tag("application", "my-app"));
            }
        }