Example #1
0
        public void CreateDashboard()
        {
            var d = File.ReadAllText("grafana/dashboards/Overview.json");

            var g = new Compose.Grafana("http://localhost:" + port);

            try
            {
                g.AddDashboard(
                    new Dashboard()
                {
                    DashboardData = JsonConvert.DeserializeObject(d)
                }).Wait();

                g.Dispose();
            }
            catch (Exception)
            {
                TestContext.Out.WriteLine("Error - disposing objects.");
                g.Dispose();
                throw;
            }

            Assert.Pass();
        }
Example #2
0
        public void CreateDataSource()
        {
            var g = new Compose.Grafana("http://localhost:" + port);

            try
            {
                var dataSource = new DataSource()
                {
                    ID                = 1,
                    OrgID             = 1,
                    Name              = "og-prometheus",
                    Type              = "prometheus",
                    Access            = "proxy",
                    URL               = "http://og-prometheus:9090",
                    Password          = "",
                    User              = "",
                    Database          = "",
                    BasicAuth         = false,
                    BasicAuthUser     = "",
                    BasicAuthPassword = "",
                    IsDefault         = true,
                    JsonData          = null
                };

                g.AddDataSource(dataSource).Wait();

                g.Dispose();
            }
            catch (Exception e)
            {
                TestContext.Out.WriteLine("Error - disposing objects.");
                g.Dispose();
                throw e;
            }

            Assert.Pass();
        }