Documentation
¶
Index ¶
- Constants
- func InitConfig(override, defaultConfig string)
- type ConfigStruct
- type DataSourceFilters
- type DataSourceSettings
- type GrafanaConfig
- func (s *GrafanaConfig) GetAlertNotificationOutput() string
- func (s *GrafanaConfig) GetCredentialByUrl(fullUrl string) (*GrafanaDataSource, error)
- func (s *GrafanaConfig) GetCredentials(dataSourceName string) (*GrafanaDataSource, error)
- func (s *GrafanaConfig) GetDashboardOutput() string
- func (s *GrafanaConfig) GetDataSourceOutput() string
- func (s *GrafanaConfig) GetDataSourceSettings() *DataSourceSettings
- func (s *GrafanaConfig) GetDefaultCredentials() *GrafanaDataSource
- func (s *GrafanaConfig) GetFolderOutput() string
- func (s *GrafanaConfig) GetMonitoredFolders() []string
- func (s *GrafanaConfig) GetUserOutput() string
- type GrafanaDataSource
- type ResourceType
Constants ¶
View Source
const ( UserResource = "users" DashboardResource = "dashboards" DataSourceResource = "datasources" FolderResource = "folders" AlertNotificationResource = "alertnotifications" )
Variables ¶
This section is empty.
Functions ¶
func InitConfig ¶
func InitConfig(override, defaultConfig string)
Types ¶
type ConfigStruct ¶
type ConfigStruct struct {
// contains filtered or unexported fields
}
func Config ¶
func Config() *ConfigStruct
func (*ConfigStruct) Contexts ¶
func (s *ConfigStruct) Contexts() map[string]*GrafanaConfig
Contexts returns map of all contexts
func (ConfigStruct) IgnoreSSL ¶
func (s ConfigStruct) IgnoreSSL() bool
IgnoreSSL returns true if SSL errors should be ignored
func (ConfigStruct) IsDebug ¶
func (s ConfigStruct) IsDebug() bool
IsDebug returns true if debug mode is enabled
func (*ConfigStruct) ViperConfig ¶
func (s *ConfigStruct) ViperConfig() *viper.Viper
ViperConfig returns the loaded configuration via a viper reference
type DataSourceFilters ¶
type DataSourceFilters struct {
NameExclusions string `yaml:"name_exclusions"`
DataSourceTypes []string `yaml:"valid_types"`
// contains filtered or unexported fields
}
func (DataSourceFilters) ValidDataType ¶
func (filter DataSourceFilters) ValidDataType(dataType string) bool
func (*DataSourceFilters) ValidName ¶
func (filter *DataSourceFilters) ValidName(name string) bool
type DataSourceSettings ¶
type DataSourceSettings struct {
Filters *DataSourceFilters `yaml:"filters"`
Credentials map[string]*GrafanaDataSource `yaml:"credentials"`
}
func (DataSourceSettings) FiltersEnabled ¶
func (ds DataSourceSettings) FiltersEnabled() bool
func (*DataSourceSettings) GetCredentials ¶
func (ds *DataSourceSettings) GetCredentials(dataSourceName string) (*GrafanaDataSource, error)
type GrafanaConfig ¶
type GrafanaConfig struct {
Storage string `yaml:"storage"`
AdminEnabled bool
IgnoreFilters bool `yaml:"ignore_filters"`
URL string `yaml:"url"`
APIToken string `yaml:"token"`
UserName string `yaml:"user_name"`
Password string `yaml:"password"`
Organization string `yaml:"organization"`
MonitoredFolders []string `yaml:"watched"`
DefaultDataSource *GrafanaDataSource `yaml:"-"`
DataSourceSettings *DataSourceSettings `yaml:"datasources"`
OutputPath string `yaml:"output_path"`
}
GrafanaConfig model wraps auth and watched list for grafana
func (*GrafanaConfig) GetAlertNotificationOutput ¶
func (s *GrafanaConfig) GetAlertNotificationOutput() string
func (*GrafanaConfig) GetCredentialByUrl ¶
func (s *GrafanaConfig) GetCredentialByUrl(fullUrl string) (*GrafanaDataSource, error)
GetCredentialByUrl attempts to match URL by regex
func (*GrafanaConfig) GetCredentials ¶
func (s *GrafanaConfig) GetCredentials(dataSourceName string) (*GrafanaDataSource, error)
GetCredentials return credentials for a given datasource or falls back on default value
func (*GrafanaConfig) GetDashboardOutput ¶
func (s *GrafanaConfig) GetDashboardOutput() string
func (*GrafanaConfig) GetDataSourceOutput ¶
func (s *GrafanaConfig) GetDataSourceOutput() string
func (*GrafanaConfig) GetDataSourceSettings ¶
func (s *GrafanaConfig) GetDataSourceSettings() *DataSourceSettings
func (*GrafanaConfig) GetDefaultCredentials ¶
func (s *GrafanaConfig) GetDefaultCredentials() *GrafanaDataSource
GetDefaultCredentials returns the default credentials
func (*GrafanaConfig) GetFolderOutput ¶
func (s *GrafanaConfig) GetFolderOutput() string
func (*GrafanaConfig) GetMonitoredFolders ¶
func (s *GrafanaConfig) GetMonitoredFolders() []string
GetMonitoredFolders return a list of the monitored folders alternatively returns the "General" folder.
func (*GrafanaConfig) GetUserOutput ¶
func (s *GrafanaConfig) GetUserOutput() string
type GrafanaDataSource ¶
type GrafanaDataSource struct {
User string `yaml:"user"`
Password string `yaml:"password"`
UrlRegex string `yaml:"url_regex"`
}
Default datasource credentials
type ResourceType ¶
type ResourceType string
Click to show internal directories.
Click to hide internal directories.