Skip to content

Commit

Permalink
Merge pull request #8 from inexio/dev
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
TheFireMike authored Feb 8, 2021
2 parents 144a074 + 77f872f commit b126988
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/inexio/thola)](https://goreportcard.com/report/github.com/inexio/thola)
[![GitHub code style](https://img.shields.io/badge/code%20style-uber--go-brightgreen)](https://github.com/uber-go/guide/blob/master/style.md)
[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://github.com/inexio/thola/blob/main/LICENSE)
![GitHub branch checks state](https://img.shields.io/github/checks-status/inexio/thola/main)
[![GitHub branch checks state](https://img.shields.io/github/checks-status/inexio/thola/main)](https://github.com/inexio/thola/actions)
[![GoDoc doc](https://img.shields.io/badge/docs-online-brightgreen)](https://docs.thola.io)

## Description
Expand Down Expand Up @@ -38,6 +38,7 @@ Thola currently has three main modes of operation with various subcommands:
- `read cpu-load` returns the current cpu load of all CPUs.
- `read memory-usage` reads out the current memory usage.
- `read ups` outputs the special values of a UPS device.
- `read sbc` reads out SBC specific information.
- `check` performs checks that can be used in monitoring systems. Output is by default in check plugin format.
- `check identify` compares the device properties with given expectations.
- `check snmp` checks SNMP reachability.
Expand All @@ -46,6 +47,7 @@ Thola currently has three main modes of operation with various subcommands:
- `check memory-usage` checks the current memory usage against given thresholds.
- `check ups` checks if a UPS device has its main voltage applied and outputs additional performance data like battery capacity or current load, and compares them to optionally given thresholds.
- `check thola-server` checks reachability of a Thola API.
- `check sbc` checks an SBC device and outputs metrics for each realm and agent as performance data.

More features are coming soon:

Expand Down
1 change: 1 addition & 0 deletions api/request_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ func StartAPI() {

// Start server
go func() {
var err error
if viper.GetString("api.certfile") != "" && viper.GetString("api.keyfile") != "" {
err = e.StartTLS(":"+viper.GetString("api.port"), viper.GetString("api.certfile"), viper.GetString("api.keyfile"))
} else {
Expand Down
9 changes: 8 additions & 1 deletion core/network/snmp_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,14 @@ func (s *SNMPClient) SNMPGet(ctx context.Context, oid ...string) ([]SNMPResponse
// SNMPWalk sends a snmpwalk request to the specified oid.
func (s *SNMPClient) SNMPWalk(ctx context.Context, oid string) ([]SNMPResponse, error) {
s.client.Context = ctx
response, err := s.client.WalkAll(oid)

var response []gosnmp.SnmpPDU
var err error
if s.client.Version == gosnmp.Version1 {
response, err = s.client.WalkAll(oid)
} else {
response, err = s.client.BulkWalkAll(oid)
}
if err != nil {
return nil, errors.Wrap(err, "snmpwalk all failed")
}
Expand Down
9 changes: 9 additions & 0 deletions core/request/check_sbc_request_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ func (r *CheckSBCRequest) process(ctx context.Context) (Response, error) {
}
}

if sbc.SystemRedundancy != nil {
err = r.mon.AddPerformanceDataPoint(monitoringplugin.NewPerformanceDataPoint("system_redundancy", *sbc.LicenseCapacity, ""))
if r.mon.UpdateStatusOnError(err, monitoringplugin.UNKNOWN, "error while adding performance data point", true) {
return &CheckResponse{r.mon.GetInfo()}, nil
}

r.mon.UpdateStatusIf(*sbc.SystemRedundancy != 2 && *sbc.SystemRedundancy != 3, monitoringplugin.CRITICAL, "system redundancy is critical")
}

for _, agent := range sbc.Agents {
if agent.CurrentActiveSessionsInbound != nil {
p := monitoringplugin.NewPerformanceDataPoint("current_active_sessions_inbound", *agent.CurrentActiveSessionsInbound, "").SetLabel(agent.Hostname)
Expand Down
2 changes: 1 addition & 1 deletion doc/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
// swagger:meta
package doc

const Version = "v0.1.4"
const Version = "v0.2.0"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/google/go-cmp v0.5.4
github.com/gosnmp/gosnmp v1.29.0
github.com/huandu/go-sqlbuilder v1.8.0
github.com/inexio/go-monitoringplugin v0.0.0-20201117085742-ec06ef4904fe
github.com/inexio/go-monitoringplugin v1.0.0
github.com/jmoiron/sqlx v1.2.0
github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.3.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ github.com/huandu/go-sqlbuilder v1.8.0 h1:1KP21dzROt03II0aoX/rD2Y6TX1VCIixSX5mvk
github.com/huandu/go-sqlbuilder v1.8.0/go.mod h1:cM38aLPrMXaGxsUkHFh1e2skthPnQRPK7h8//X5LQMc=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inexio/go-monitoringplugin v0.0.0-20201117085742-ec06ef4904fe h1:08N/oNUAKUjMFb406F4mcJUZwZsWy9NyKrpauWgGfyU=
github.com/inexio/go-monitoringplugin v0.0.0-20201117085742-ec06ef4904fe/go.mod h1:kzHRJGZ2iE/0IElB4NYI38h3h0HM5wqTTH7KyUCjkM8=
github.com/inexio/go-monitoringplugin v1.0.0 h1:aOGOF+vBEwfQNnzFPWJKFWyY3HwV3zzd1HbUljm3Saw=
github.com/inexio/go-monitoringplugin v1.0.0/go.mod h1:kzHRJGZ2iE/0IElB4NYI38h3h0HM5wqTTH7KyUCjkM8=
github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
Expand Down

0 comments on commit b126988

Please sign in to comment.