Documentation ¶
Index ¶
- Variables
- func ContainsString(str string, slice []string) bool
- func Execute()
- func FirstValueInSlice(subSlice []string, slice []string) string
- func GetPassword(secret internal.Secret, tenant string) (string, error)
- func GetSecretKey() ([]byte, error)
- func PwDecrypt(encrypted, byteSecret []byte) (string, error)
- func PwEncrypt(bytePw, byteSecret []byte) ([]byte, error)
- func RootHandler(w http.ResponseWriter, r *http.Request)
- func SubSliceInSlice(subSlice []string, slice []string) bool
- type Config
- func (config *Config) AdaptSchemaFilter()
- func (config *Config) AddSecret(tenants string, pw []byte) ([]byte, error)
- func (config *Config) CollectMetric(mPos int) []MetricRecord
- func (config *Config) CollectMetrics() []MetricData
- func (config *Config) FindTenant(cmpTenant string) TenantInfo
- func (config *Config) GetMetricData(mPos, tPos int) []MetricRecord
- func (config *Config) GetSecretMap() (internal.Secret, error)
- func (config *Config) GetSelection(mPos, tPos int) string
- func (config *Config) GetTestData1(mPos, tPos int) []MetricRecord
- func (config *Config) GetTestData2(mPos, tPos int) []MetricRecord
- func (config *Config) SetPw(cmd *cobra.Command) error
- func (config *Config) Web() error
- type MetricData
- type MetricInfo
- type MetricRecord
- type TenantInfo
Constants ¶
This section is empty.
Variables ¶
var RootCmd = &cobra.Command{
Use: "hana_sql_exporter",
Short: "The purpose of this hana_sql_exporter is to support monitoring SAP and SAP HanaDB instances with Prometheus and Grafana.",
Long: `The purpose of the hana_sql_exporter is to support monitoring SAP and SAP HanaDB instances with Prometheus and Grafana. As the name suggests, with the hana_sql_exporter a sql select is responsible for the data retrieval. By definition the first column must represent the value of the metric. The following columns are used as labels and must be string values.`,
}
RootCmd represents the base command when called without any subcommands
Functions ¶
func ContainsString ¶
ContainsString - true, if slice contains string
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func FirstValueInSlice ¶
FirstValueInSlice - return first sublice value that exists in slice
func GetPassword ¶
GetPassword - decrypt password
func RootHandler ¶
func RootHandler(w http.ResponseWriter, r *http.Request)
RootHandler - message, when calling mithout /metrics
func SubSliceInSlice ¶
SubSliceInSlice - true, if every item in sublice exists in slice or sublice is empty
Types ¶
type Config ¶
type Config struct { Secret []byte Tenants []TenantInfo Metrics []MetricInfo DataFunc func(mPos, tPos int) []MetricRecord Timeout uint // contains filtered or unexported fields }
Config struct with config file infos
func (*Config) AdaptSchemaFilter ¶
func (config *Config) AdaptSchemaFilter()
AdaptSchemaFilter - add sys schema to SchemaFilter if it does not exists
func (*Config) CollectMetric ¶
func (config *Config) CollectMetric(mPos int) []MetricRecord
CollectMetric - collecting one metric for every tenants
func (*Config) CollectMetrics ¶
func (config *Config) CollectMetrics() []MetricData
CollectMetrics - collecting all metrics and fetch the results
func (*Config) FindTenant ¶
func (config *Config) FindTenant(cmpTenant string) TenantInfo
FindTenant - check if cmpTenant already exists in configfile
func (*Config) GetMetricData ¶
func (config *Config) GetMetricData(mPos, tPos int) []MetricRecord
GetMetricData - metric data for one tenant
func (*Config) GetSecretMap ¶
GetSecretMap - unmarshal secret bytes
func (*Config) GetSelection ¶
GetSelection - prepare the db selection
func (*Config) GetTestData1 ¶
func (config *Config) GetTestData1(mPos, tPos int) []MetricRecord
GetTestData1 - for testing purpose only
func (*Config) GetTestData2 ¶
func (config *Config) GetTestData2(mPos, tPos int) []MetricRecord
GetTestData2 - for testing purpose only
type MetricData ¶
type MetricData struct { Name string Help string MetricType string Stats []MetricRecord }
MetricData - metric data
type MetricInfo ¶
type MetricInfo struct { Name string Help string MetricType string TagFilter []string SchemaFilter []string SQL string }
MetricInfo - metric data
type MetricRecord ¶
MetricRecord - metric stats record
type TenantInfo ¶
type TenantInfo struct { Name string Tags []string ConnStr string User string Usage string Schemas []string // contains filtered or unexported fields }
TenantInfo - tennant data
func (*TenantInfo) GetMetricRows ¶
func (tenant *TenantInfo) GetMetricRows(rows *sql.Rows) ([]MetricRecord, error)
GetMetricRows - return the metric values