Skip to content

Commit

Permalink
Scrape more Instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Neumann committed Jul 9, 2019
1 parent 30fb66f commit ac3f146
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type Exporter struct {

var (
// Version will be set at build time.
Version = "1.1.2"
Version = "1.1.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.")
pTabRows = flag.Bool("tablerows", false, "Expose Table rows (CAN TAKE VERY LONG)")
Expand Down Expand Up @@ -224,7 +224,7 @@ func (e *Exporter) ScrapeQuery() {
for _, query := range conn.Queries {
rows, err = conn.db.Query(query.Sql)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand All @@ -251,7 +251,7 @@ func (e *Exporter) ScrapeParameter() {
if conn.db != nil {
rows, err = conn.db.Query(`select name,value from v$parameter WHERE num=43`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand All @@ -278,7 +278,7 @@ func (e *Exporter) ScrapeServices() {
if conn.db != nil {
rows, err = conn.db.Query(`select name from v$active_services`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -311,7 +311,7 @@ func (e *Exporter) ScrapeCache() {
from v$sysmetric
where group_id=2 and metric_id in (2000,2050,2112,2110)`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand All @@ -338,7 +338,7 @@ func (e *Exporter) ScrapeRedo() {
if conn.db != nil {
rows, err = conn.db.Query(`select count(*) from v$log_history where first_time > sysdate - 1/24/12`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand All @@ -363,7 +363,7 @@ func (e *Exporter) ScrapeRecovery() {
rows, err = conn.db.Query(`SELECT sum(percent_space_used) , sum(percent_space_reclaimable)
from V$FLASH_RECOVERY_AREA_USAGE`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -391,7 +391,7 @@ func (e *Exporter) ScrapeInterconnect() {
FROM V$SYSSTAT
WHERE name in ('gc cr blocks served','gc cr blocks flushed','gc cr blocks received')`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -421,7 +421,7 @@ func (e *Exporter) ScrapeAsmspace() {
AND d.header_status = 'MEMBER'
GROUP by g.name, g.group_number`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -463,7 +463,7 @@ func (e *Exporter) ScrapeTablespace() {
FROM dba_temp_free_space
GROUP BY tablespace_name`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -495,7 +495,7 @@ func (e *Exporter) ScrapeSession() {
FROM v$session
GROUP BY decode(username,NULL,'SYSTEM','SYS','SYSTEM','USER'),status`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -537,7 +537,7 @@ func (e *Exporter) ScrapeSysstat() {
rows, err = conn.db.Query(`SELECT name, value FROM v$sysstat
WHERE statistic# in (6,7,1084,1089)`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -565,7 +565,7 @@ func (e *Exporter) ScrapeWaitclass() {
FROM v$waitclassmetric m, v$system_wait_class n
WHERE m.wait_class_id=n.wait_class_id and n.wait_class != 'Idle'`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -596,7 +596,7 @@ func (e *Exporter) ScrapeSysmetric() {
if conn.db != nil {
rows, err = conn.db.Query("select metric_name,value from v$sysmetric where metric_id in (2092,2093,2124,2100)")
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -624,7 +624,7 @@ func (e *Exporter) ScrapeTablerows() {
from dba_tables
where owner not like '%SYS%' and num_rows is not null`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -655,7 +655,7 @@ func (e *Exporter) ScrapeTablebytes() {
WHERE stab.owner = tab.owner AND stab.segment_name = tab.table_name
AND tab.owner NOT LIKE '%SYS%'`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -686,7 +686,7 @@ func (e *Exporter) ScrapeIndexbytes() {
and table_owner NOT LIKE '%SYS%'
group by table_owner,table_name`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -717,7 +717,7 @@ func (e *Exporter) ScrapeLobbytes() {
and l.owner NOT LIKE '%SYS%'
group by l.owner,l.table_name`)
if err != nil {
break
continue
}
defer rows.Close()
for rows.Next() {
Expand Down Expand Up @@ -779,7 +779,7 @@ func (e *Exporter) Connect() {
if err == nil {
err = config.Cfgs[i].db.QueryRow("select db_unique_name,instance_name from v$database,v$instance").Scan(&dbname,&inname)
if err == nil {
if (conf.Database != dbname) || (conf.Instance != inname) {
if (len(conf.Database)==0) || (len(conf.Instance)==0) {
config.Cfgs[i].Database = dbname
config.Cfgs[i].Instance = inname
}
Expand Down

0 comments on commit ac3f146

Please sign in to comment.