Skip to content

Add support for stats from /proc/net/snmp as well.#85

Merged
beorn7 merged 1 commit intoprometheus:masterfrom
jtakkala:snmpStats
Jul 16, 2015
Merged

Add support for stats from /proc/net/snmp as well.#85
beorn7 merged 1 commit intoprometheus:masterfrom
jtakkala:snmpStats

Conversation

@jtakkala
Copy link
Contributor

This is the naive implementation for #59. I thought of a few other approaches, mainly looping over a list of files and doing the merge of maps in getStats(). Any other approach would be longer though and I'm not sure of its benefit given the limited and well defined set of inputs (/proc/net/netstat, /proc/net/snmp). I'm happy to hear other opinions if you think this can be refactored a bit more. @matthiasr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe distinguish the error messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thought of that, but then the problem comes up at line 68 as well. Maybe I'll just change line 68 then to 'couldn't distinguish stats'. Good call though, I'll change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forget what I said about line 68. I think the invalid value message applies to the merged stats just fine. I think it's a minor nitpick, but it could simply be "stats", but then we should start renaming the variables to just 'stats' and copying both maps to it.

@juliusv
Copy link
Member

juliusv commented Jul 11, 2015

@jtakkala Oh sorry, I never looked at this again because there was no ping on the PR after the latest updates. Taking a look now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This'd be snmpStats in common Go style (local variables are never capitalized at the beginning).

@juliusv
Copy link
Member

juliusv commented Jul 11, 2015

👍 besides last nits. Then squash in the end please :)

@jtakkala jtakkala force-pushed the snmpStats branch 5 times, most recently from 2be4b46 to 45f46fa Compare July 15, 2015 16:13
@jtakkala
Copy link
Contributor Author

@juliusv fixed all nits. Good to merge now?

@beorn7
Copy link
Member

beorn7 commented Jul 16, 2015

All of Julius's points are addressed, as it seems. Since he is on vacation, I'll rubberstamp this...

beorn7 added a commit that referenced this pull request Jul 16, 2015
Add support for stats from /proc/net/snmp as well.
@beorn7 beorn7 merged commit aca4688 into prometheus:master Jul 16, 2015
appliedprivacy added a commit to appliedprivacy/node_exporter that referenced this pull request Oct 28, 2021
make clear that the netstat collector also reads 
/proc/net/snmp (prometheus#85) and not just /proc/net/netstat to avoid
confusions like prometheus#2179
tamcore pushed a commit to gitgrave/node_exporter that referenced this pull request Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants