Пример #1
0
        private static void SendMetricsWithUdpChannel(string host)
        {
            var uri = new Uri($"udp://{host}:8094");

            using (var channel = new UdpTelegrafChannel(uri))
            {
                //[[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_udp_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);
            }
        }
Пример #2
0
        private static void SendMetricsWithUdpChannel(string host)
        {
            var uri = new Uri($"udp://{host}:8125");

            using (var channel = new UdpTelegrafChannel(uri))
            {
                //[[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_udp_cannel" },
                    { "host", Environment.MachineName }
                };

                var client = new TelegrafStatsdClient(channel, defaultTags);

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