Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ofesseler/gluster_exporter
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: insoIite/gluster_exporter
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on May 11, 2017

  1. Add option in order to not perform a heal info

    When there is no healing files, the gluster volume heal info command
    is quite fast. But in case of problems it can take more than 10s to
    answer for only one volume. In this case your gluster exporter will
    not work (command answer time > scrape time etc...).
    Furthermore the load of your gluster server will rise very high.
    Fabien Dugast committed May 11, 2017
    Copy the full SHA
    15c083d View commit details
  2. Update Readme

    Fabien Dugast committed May 11, 2017
    Copy the full SHA
    a9c8835 View commit details
Showing with 19 additions and 11 deletions.
  1. +6 −3 README.md
  2. +13 −8 main.go
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -24,6 +24,9 @@ Help is displayed with `-h`.
| -profile | `false` | When profiling reports in gluster are enabled, set ' -profile true' to get more metrics
| -version | - | Prints version information
| -volumes | `_all` | Comma separated volume names: vol1,vol2,vol3. Default is '_all' to scrape all metrics
| -quota | `false` | When quota in gluster are enabled, set '-quota' to get more metrics
| -no-heal-scrape | `false` | The exporter will not get metrics about healing files



## Make
@@ -40,8 +43,8 @@ docker: build and run in docker container
**docker**: runs docker build and copys new builded gluster_exporter


## Relevant Gluster Metrics
Commands within the exporter are executed with `--xml`.
## Relevant Gluster Metrics
Commands within the exporter are executed with `--xml`.

### Command: `gluster volume info`

@@ -78,7 +81,7 @@ with `gluster volume info` this is obsolete
| volProfile.cumulativeStatus.duration | Count | implemented |
| volProfile.cumulativeStatus.totalRead | Count | implemented |
| volProfile.cumulativeStatus.totalWrite | Count | implemented |
| volProfile.cumulativeStats.fopStats.fop.Name | WRITE, STATFS, FLUSH, OPENDIR, CREATE, LOOKUP, READDIR, FINODELK, ENTRYLK, FXATTROP | pending |
| volProfile.cumulativeStats.fopStats.fop.Name | WRITE, STATFS, FLUSH, OPENDIR, CREATE, LOOKUP, READDIR, FINODELK, ENTRYLK, FXATTROP | pending |
| volProfile.cumulativeStats.fopStats.fop.hits | count | implemented |
| volProfile.cumulativeStats.fopStats.fop.avgLatency | Gauge | implemented |
| volProfile.cumulativeStats.fopStats.fop.minLatency | Gauge | implemented |
21 changes: 13 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
@@ -173,6 +173,7 @@ type Exporter struct {
volumes []string
profile bool
quota bool
noHeal bool
}

// Describe all the metrics exported by Gluster exporter. It implements prometheus.Collector.
@@ -327,12 +328,14 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
vols = volumeList.Volume
}

for _, vol := range vols {
filesCount, volumeHealErr := ExecVolumeHealInfo(vol)
if volumeHealErr == nil {
ch <- prometheus.MustNewConstMetric(
healInfoFilesCount, prometheus.CounterValue, float64(filesCount), vol,
)
if !e.noHeal {
for _, vol := range vols {
filesCount, volumeHealErr := ExecVolumeHealInfo(vol)
if volumeHealErr == nil {
ch <- prometheus.MustNewConstMetric(
healInfoFilesCount, prometheus.CounterValue, float64(filesCount), vol,
)
}
}
}

@@ -473,7 +476,7 @@ func ContainsVolume(slice []string, element string) bool {
}

// NewExporter initialises exporter
func NewExporter(hostname, glusterExecPath, volumesString string, profile bool, quota bool) (*Exporter, error) {
func NewExporter(hostname, glusterExecPath, volumesString string, profile bool, quota bool, noHeal bool) (*Exporter, error) {
if len(glusterExecPath) < 1 {
log.Fatalf("Gluster executable path is wrong: %v", glusterExecPath)
}
@@ -488,6 +491,7 @@ func NewExporter(hostname, glusterExecPath, volumesString string, profile bool,
volumes: volumes,
profile: profile,
quota: quota,
noHeal: noHeal,
}, nil
}

@@ -511,6 +515,7 @@ func main() {
glusterVolumes = flag.String("volumes", allVolumes, fmt.Sprintf("Comma separated volume names: vol1,vol2,vol3. Default is '%v' to scrape all metrics", allVolumes))
profile = flag.Bool("profile", false, "When profiling reports in gluster are enabled, set ' -profile true' to get more metrics")
quota = flag.Bool("quota", false, "When quota in gluster are enabled, set ' -quota true' to get more metrics")
noHeal = flag.Bool("no-heal-scrape", false, "Do not scrape heal info")
)
flag.Parse()

@@ -522,7 +527,7 @@ func main() {
if err != nil {
log.Fatalf("While trying to get Hostname error happened: %v", err)
}
exporter, err := NewExporter(hostname, *glusterPath, *glusterVolumes, *profile, *quota)
exporter, err := NewExporter(hostname, *glusterPath, *glusterVolumes, *profile, *quota, *noHeal)
if err != nil {
log.Errorf("Creating new Exporter went wrong, ... \n%v", err)
}