Esempio n. 1
0
        static void Main(string[] args)
        {
            var apiKey = Environment.GetEnvironmentVariable("DATADOG_API_KEY");
            var appKey = Environment.GetEnvironmentVariable("DATADOG_APP_KEY");

            using (var client = new DogApiClient(apiKey, appKey))
            {
                var postResult = client.Metric.PostAsync(new[]
                {
                    new DogMetric("test.metric", 500),
                    new DogMetric("test.metric2", 300)
                }).Result;

                var to          = DateTimeOffset.Now;
                var from        = to.AddMinutes(-30);
                var queryResult = client.Metric.QueryAsync(from, to, "test.metric{*}").Result;
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var apiKey = Environment.GetEnvironmentVariable("DATADOG_API_KEY");
            var appKey = Environment.GetEnvironmentVariable("DATADOG_APP_KEY");

            using (var client = new DogApiClient(apiKey, appKey))
            {
                //var postResult = client.Event.PostAsync(new DogEventPostParameter("TEST TITLE")
                //{
                //    Text = "AAA",
                //    AlertType = "Info",
                //    Tags = new[] { "test:1" },
                //    AggregationKey = "AAA",
                //}).Result;

                //postResult = client.Event.PostAsync(new DogEventPostParameter("TEST TITLE")
                //{
                //    Text = "AAA",
                //    AlertType = "Info",
                //    Tags = new[] { "test:1" },
                //    AggregationKey = "AAA",
                //}).Result;

                //var getResult = client.Event.GetAsync(postResult.Event.Id).Result;

                //var deleteResult = client.Event.DeleteAsync(getResult.Event.Id).Result;

                //var result = client.Metric.GetListAsync(DateTimeOffset.Now - TimeSpan.FromDays(1)).Result;

                //var resutl = client.Metric.PostAsync(new DogMetricPostParameter("test.metric", DateTimeOffset.Now, 123.4)).Result;

                //var result = client.Metric.QueryAsync(DateTimeOffset.Now - TimeSpan.FromDays(1), DateTimeOffset.Now, "test.metric{*}by{host}").Result;

                var updateResult = client.Metadata.UpdateAsync(new DogMetadataUpdateParameter("test.metric")
                {
                    Description = null, ShortName = null, PerUnit = null, Unit = null, Type = null, StatsDInterval = null
                }).Result;
                var getResutl = client.Metadata.GetAsync("test.metric").Result;
            }
        }
Esempio n. 3
0
        static async Task Main(string[] args)
        {
            var apiKey = Environment.GetEnvironmentVariable("DATADOG_API_KEY");
            var appKey = Environment.GetEnvironmentVariable("DATADOG_APP_KEY");

            using (var client = new DogApiClient(apiKey, appKey))
            {
                var users = await client.User.GetAllAsync();

                var user = await client.User.GetAsync(users[0].Handle);

                var newUser = await client.User.CreateAsync("*****@*****.**", "test", "ro");

                newUser.Name       = "update name";
                newUser.EMail      = "*****@*****.**";
                newUser.AccessRole = "adm";
                newUser.Disabled   = false;

                var update = await client.User.UpdateAsync(newUser);

                await client.User.DeleteAsync(update.Handle);
            }
        }