Documentation ¶
Overview ¶
** Copyright [2013-2017] [Megam Systems] ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
Index ¶
- Constants
- Variables
- func AbortWith(message string)
- func FetchURL(url string) (b []byte, e error)
- func SendMetricsToScylla(metrics Sensors, hostname string) (err error)
- func SendMetricsToStdout(metrics Sensors, hostname string)
- type Backups
- type CPUStats
- type CephRGWStats
- func (rgw *CephRGWStats) Collect(c *MetricsCollection) (e error)
- func (c *CephRGWStats) CollectMetricsFromStats(mc *MetricsCollection, acts []*carton.Account)
- func (rgw *CephRGWStats) DeductBill(c *MetricsCollection) (e error)
- func (rgw *CephRGWStats) Prefix() string
- func (c *CephRGWStats) ReadUsers() ([]*carton.Account, error)
- type CephStorage
- type Handler
- type InstanceHandler
- func (i *InstanceHandler) Collect(mc *MetricsCollection) (e error)
- func (i *InstanceHandler) CollectMetricsFromStats(mc *MetricsCollection, amies []carton.Assemblies, sensorType string)
- func (i *InstanceHandler) DeductBill(c *MetricsCollection) (e error)
- func (i *InstanceHandler) ParseAssemblies(orgs []carton.Organization, users map[string]*carton.Account) (map[string][]carton.Assemblies, error)
- func (on *InstanceHandler) Prefix() string
- func (i *InstanceHandler) ReadOrgs() ([]carton.Organization, error)
- func (i *InstanceHandler) ReadUsers() (map[string]*carton.Account, error)
- type Metric
- type MetricCollector
- type MetricHandler
- type Metrics
- type MetricsCollection
- type MetricsMap
- type Metrix
- type OutputHandler
- type Sensor
- type Sensors
- type Snapshots
- func (s *Snapshots) Collect(c *MetricsCollection) (e error)
- func (c *Snapshots) CollectMetricsFromStats(mc *MetricsCollection, snps []carton.Snaps)
- func (r *Snapshots) DeductBill(c *MetricsCollection) (e error)
- func (r *Snapshots) Prefix() string
- func (c *Snapshots) ReadUsers() ([]*carton.Account, error)
- type Stats
Constants ¶
const ( BACKUPS = "backups" BACKUPS_SENSOR = "instance.backups.exists" )
const ( OPENNEBULA = "one" QUOTA = "quota" ONDEMAND = "ondemand" INSTANCE = "instance" DOCKER = "docker" )
const ( CPU_UNIT = "cpu_unit" MEMORY_UNIT = "memory_unit" DISK_UNIT = "disk_unit" CPU_COST = "cpu_cost" MEMORY_COST = "memory_cost" CPU_COST_PER_HOUR = "cpu_cost_per_hour" RAM_COST_PER_HOUR = "ram_cost_per_hour" DISK_COST = "disk_cost" STORAGE_COST_PER_HOUR = "storage_cost_per_hour" STORAGE_COST = "storage_cost" STORAGE_UNIT = "storage_unit" SKEWS_ACTIONS = "skews_actions" SKEWS_ACTION = "action" GRACEPERIOD = "grace_period" CREDIT_LIMIT = "credit_limit" )
const ( SENSORSBUCKET = "sensors" CEPH_STORAGE_SENSOR = "storage.ceph.buckets" ONE_VM_SENSOR = "compute.vm.exists" DOCKER_CONTAINER_SENSOR = "compute.container.exists" )
const ( SNAPSHOTS = "snapshots" SNAPSHOT_SENSOR = "instance.snapshots.exists" )
const (
CEPHRGW = "ceph_rgw"
)
Variables ¶
var MetricsInterval time.Duration
Functions ¶
func SendMetricsToScylla ¶
func SendMetricsToStdout ¶
Types ¶
type Backups ¶
func (*Backups) Collect ¶
func (s *Backups) Collect(c *MetricsCollection) (e error)
func (*Backups) CollectMetricsFromStats ¶
func (c *Backups) CollectMetricsFromStats(mc *MetricsCollection, bks []carton.Backups)
actually the NewSensor can create trypes based on the event type.
func (*Backups) DeductBill ¶
func (r *Backups) DeductBill(c *MetricsCollection) (e error)
type CephRGWStats ¶
type CephRGWStats struct { Url string AdminUser string MasterKey string AccessKey string SecretKey string UserId string UserPrefix string DefaultUnits map[string]string RawStatus []byte }
func (*CephRGWStats) Collect ¶
func (rgw *CephRGWStats) Collect(c *MetricsCollection) (e error)
func (*CephRGWStats) CollectMetricsFromStats ¶
func (c *CephRGWStats) CollectMetricsFromStats(mc *MetricsCollection, acts []*carton.Account)
actually the NewSensor can create trypes based on the event type.
func (*CephRGWStats) DeductBill ¶
func (rgw *CephRGWStats) DeductBill(c *MetricsCollection) (e error)
func (*CephRGWStats) Prefix ¶
func (rgw *CephRGWStats) Prefix() string
type CephStorage ¶
type CephStorage struct { }
type InstanceHandler ¶
type InstanceHandler struct { Deployd bool Dockerd bool ContainerUnits map[string]string Flavors map[string]*carton.Flavor VMUnits map[string]string SkewsActions map[string]string }
func (*InstanceHandler) Collect ¶
func (i *InstanceHandler) Collect(mc *MetricsCollection) (e error)
func (*InstanceHandler) CollectMetricsFromStats ¶
func (i *InstanceHandler) CollectMetricsFromStats(mc *MetricsCollection, amies []carton.Assemblies, sensorType string)
actually the NewSensor can create trypes based on the event type.
func (*InstanceHandler) DeductBill ¶
func (i *InstanceHandler) DeductBill(c *MetricsCollection) (e error)
func (*InstanceHandler) ParseAssemblies ¶
func (i *InstanceHandler) ParseAssemblies(orgs []carton.Organization, users map[string]*carton.Account) (map[string][]carton.Assemblies, error)
func (*InstanceHandler) Prefix ¶
func (on *InstanceHandler) Prefix() string
func (*InstanceHandler) ReadOrgs ¶
func (i *InstanceHandler) ReadOrgs() ([]carton.Organization, error)
type Metric ¶
type MetricCollector ¶
type MetricCollector interface { Prefix() string Collect(*MetricsCollection) error }
type MetricHandler ¶
type MetricHandler struct { }
func (*MetricHandler) Collect ¶
func (h *MetricHandler) Collect(c MetricCollector) (Sensors, error)
type MetricsCollection ¶
func (*MetricsCollection) Add ¶
func (m *MetricsCollection) Add(s *Sensor)
func (*MetricsCollection) String ¶
func (m *MetricsCollection) String() string
type MetricsMap ¶
type Metrix ¶
type Metrix struct {
Collectors map[string]*MetricCollector
}
func (*Metrix) AddCollector ¶
func (self *Metrix) AddCollector(key string, col *MetricCollector)
func (*Metrix) ReadProcFile ¶
type OutputHandler ¶
func (*OutputHandler) WriteMetrics ¶
func (o *OutputHandler) WriteMetrics(all Sensors) (e error)
type Sensor ¶
type Sensor struct { Id string `json:"id" cql:"id"` AccountId string `json:"account_id" cql:"account_id"` SensorType string `json:"sensor_type" cql:"sensor_type"` AssemblyId string `json:"assembly_id" cql:"assembly_id"` AssemblyName string `json:"assembly_name" cql:"assembly_name"` AssembliesId string `json:"assemblies_id" cql:"assemblies_id"` Node string `json:"node" cql:"node"` System string `json:"system" cql:"system"` Status string `json:"status" cql:"status"` Source string `json:"source" cql:"source"` Message string `json:"message" cql:"message"` AuditPeriodBeginning string `json:"audit_period_beginning" cql:"audit_period_beginning"` AuditPeriodEnding string `json:"audit_period_ending" cql:"audit_period_ending"` AuditPeriodDelta string `json:"audit_period_delta" cql:"audit_period_delta"` Metrics Metrics `json:"metrics" cql:"metrics"` CreatedAt time.Time `json:"created_at" cql:"created_at"` QuotaId string `json:"-"` Resources string `json:"-"` }
type Snapshots ¶
func (*Snapshots) Collect ¶
func (s *Snapshots) Collect(c *MetricsCollection) (e error)
func (*Snapshots) CollectMetricsFromStats ¶
func (c *Snapshots) CollectMetricsFromStats(mc *MetricsCollection, snps []carton.Snaps)
actually the NewSensor can create trypes based on the event type.
func (*Snapshots) DeductBill ¶
func (r *Snapshots) DeductBill(c *MetricsCollection) (e error)
type Stats ¶
type Stats struct { ContainerId string Image string MemoryUsage uint64 //in bytes CPUUnitCost string MemoryUnitCost string AllocatedMemory int64 AllocatedCpu int64 CPUStats CPUStats //in percentage of total cpu used PreCPUStats CPUStats NetworkIn uint64 NetworkOut uint64 AccountId string AssemblyId string QuotaId string AssemblyName string AssembliesId string Status string AuditPeriod time.Time }