Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make scopes configurable #4

Closed
wants to merge 2 commits into from

Conversation

@jap
Copy link

commented Oct 26, 2017

I'd like to also extract data in different scopes (such as global or session) from dovecot. By making that a command line option this becomes way easier.

The default has the same behaviour as the original code.

@EdSchouten

This comment has been minimized.

Copy link
Contributor

commented Oct 26, 2017

That looks pretty nice!

It turns out that some of the other Prometheus exporters (including some official ones) are slowly switching over to Kingpin for flags parsing. An advantage of Kingpin is that it supports multi-value arguments. That would be nice to have here, as that would eliminate the need to do the string splitting.

Could I persuade you to switch this exporter over to Kingpin? It should be relatively easy in this case. I think for the multiple string arguments, you just need to call .Strings(). Thanks!

@ronaldevers

This comment has been minimized.

Copy link

commented Oct 26, 2017

Also, aren't there going to be issues with data for other scopes being in different formats? I'm not sure, just wondering, especially given 96783d4.

@EdSchouten

This comment has been minimized.

Copy link
Contributor

commented Oct 29, 2017

Hi Ronald,

That shouldn't be an issue. When I implemented the parser, I at least ensured that it is compatible with domain, ip and user. The session one is different from the others, as it has multiple columns that use string types.

zoni added a commit to zoni/dovecot_exporter that referenced this pull request Oct 31, 2017
This allows a user to select which sets of dovecot stats he or she is
interested in.

The default has been deliberately changed mainly because it makes the
description/format more obvious, but also because gathering global stats
in addition to user stats generally makes sense.

Original credit goes to @jap
(kumina#4)
@EdSchouten

This comment has been minimized.

Copy link
Contributor

commented Nov 2, 2017

Superseded by #5 :-)

@EdSchouten EdSchouten closed this Nov 2, 2017
zoni added a commit to zoni/dovecot_exporter that referenced this pull request Jan 17, 2018
PR kumina#5 (itself based on kumina#4) introduced support to scrape the "global" scope,
however the format of these stats differs slightly from that of the
others.

As a result of this, combined with the silent return when `len(values)
!= len(columns)+1`, these metrics were being incorrectly exported as
mislabeled metrics with values of 0.

The changes in this PR accomodate for the format of the "global" scope
and now properly scrape those as well.

It will now also display an error when column counts mismatch, reducing
the likelihood of silent errors in the future.

Global metrics will now show up as:

```
dovecot_global_auth_cache_hits 0
dovecot_global_auth_cache_misses 0
dovecot_global_auth_db_tempfails 3
dovecot_global_auth_failures 6
dovecot_global_auth_master_successes 0
dovecot_global_auth_successes 228
dovecot_global_clock_time 0
dovecot_global_disk_input 0
dovecot_global_disk_output 0
dovecot_global_invol_cs 0
dovecot_global_last_update 1.516197189175826e+09
dovecot_global_mail_cache_hits 0
dovecot_global_mail_lookup_attr 0
dovecot_global_mail_lookup_path 0
dovecot_global_mail_read_bytes 0
dovecot_global_mail_read_count 0
dovecot_global_maj_faults 0
dovecot_global_min_faults 0
dovecot_global_num_cmds 0
dovecot_global_num_connected_sessions 234
dovecot_global_num_logins 234
dovecot_global_read_bytes 0
dovecot_global_read_count 0
dovecot_global_reset_timestamp 1.516190181e+09
dovecot_global_sys_cpu 0
dovecot_global_user_cpu 0
dovecot_global_vol_cs 0
dovecot_global_write_bytes 0
dovecot_global_write_count 0
dovecot_up{scope="global"} 1
```

...with the other scopes being unaffected.
zoni added a commit to zoni/dovecot_exporter that referenced this pull request Jan 17, 2018
PR kumina#5 (itself based on kumina#4) introduced support to scrape the "global" scope,
however the format of these stats differs slightly from that of the
others.

As a result of this, combined with the silent return when `len(values)
!= len(columns)+1`, these metrics were being incorrectly exported as
mislabeled metrics with values of 0.

The changes in this PR accomodate for the format of the "global" scope
and now properly scrape those as well.

It will now also display an error when column counts mismatch, reducing
the likelihood of silent errors in the future.

Global metrics will now show up as:

```
dovecot_global_auth_cache_hits 0
dovecot_global_auth_cache_misses 0
dovecot_global_auth_db_tempfails 3
dovecot_global_auth_failures 6
dovecot_global_auth_master_successes 0
dovecot_global_auth_successes 228
dovecot_global_clock_time 0
dovecot_global_disk_input 0
dovecot_global_disk_output 0
dovecot_global_invol_cs 0
dovecot_global_last_update 1.516197189175826e+09
dovecot_global_mail_cache_hits 0
dovecot_global_mail_lookup_attr 0
dovecot_global_mail_lookup_path 0
dovecot_global_mail_read_bytes 0
dovecot_global_mail_read_count 0
dovecot_global_maj_faults 0
dovecot_global_min_faults 0
dovecot_global_num_cmds 0
dovecot_global_num_connected_sessions 234
dovecot_global_num_logins 234
dovecot_global_read_bytes 0
dovecot_global_read_count 0
dovecot_global_reset_timestamp 1.516190181e+09
dovecot_global_sys_cpu 0
dovecot_global_user_cpu 0
dovecot_global_vol_cs 0
dovecot_global_write_bytes 0
dovecot_global_write_count 0
dovecot_up{scope="global"} 1
```

...with the other scopes being unaffected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.