Skip to content

Commit

Permalink
Interconnect Metrics update
Browse files Browse the repository at this point in the history
  • Loading branch information
floyd871 committed Nov 28, 2017
1 parent b3cdb8c commit 09a8364
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The following metrics are exposed currently. Support for RAC (databasename and i
- oracledb_sysstat (view v$sysstat (parse count (total) / execute count / user commits / user rollbacks))
- oracledb_waitclass (view v$waitclass)
- oracledb_tablespace (tablespace total/free)
- oracledb_interconnect (view v$sysstat (gc cr blocks received / gc cr block receive time))
- oracledb_interconnect (view v$sysstat (gc cr blocks served / gc cr blocks flushed / gc cr blocks received))
...

# Installation
Expand Down
20 changes: 9 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

var (
// Version will be set at build time.
Version = "0.0.2"
Version = "0.0.3"
listenAddress = flag.String("web.listen-address", ":9161", "Address to listen on for web interface and telemetry.")
metricPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
landingPage = []byte("<html><head><title>Prometheus Oracle exporter</title></head><body><h1>Prometheus Oracle exporter</h1><p><a href='" + *metricPath + "'>Metrics</a></p></body></html>")
Expand Down Expand Up @@ -125,23 +125,21 @@ func (e *Exporter) ScrapeInterconnect() {
err error
)
for _, conn := range e.conns {
rows, err = conn.db.Query(`SELECT a.value,b.value, (a.value/b.value)*10
FROM V$SYSSTAT a,V$SYSSTAT b
WHERE a.NAME ='gc cr blocks received' and b.name='gc cr block receive time'`)
rows, err = conn.db.Query(`SELECT name, value
FROM V$SYSSTAT
WHERE name in ('gc cr blocks served','gc cr blocks flushed','gc cr blocks received')`)
if err != nil {
break
}
defer rows.Close()
for rows.Next() {
var rectot float64
var rectime float64
var recms float64
if err := rows.Scan(&rectot, &rectime, &recms); err != nil {
var name string
var value float64
if err := rows.Scan(&name, &value); err != nil {
break
}
e.interconnect.WithLabelValues("gc_blocks_total",conn.database,conn.instance).Set(rectot)
e.interconnect.WithLabelValues("gc_blocks_time",conn.database,conn.instance).Set(rectime)
e.interconnect.WithLabelValues("gc_blocks_avg",conn.database,conn.instance).Set(recms)
name = cleanName(name)
e.interconnect.WithLabelValues(name,conn.database,conn.instance).Set(value)
}
}
}
Expand Down

0 comments on commit 09a8364

Please sign in to comment.