-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add ceph osd_df to metricbeat #5606
Conversation
Can one of the admins verify this patch? |
@@ -0,0 +1,63 @@ | |||
package osd_df |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use an underscore in package name
@@ -0,0 +1,48 @@ | |||
package osd_df |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use an underscore in package name
}, nil | ||
} | ||
|
||
func (m *MetricSet) Fetch() ([]common.MapStr, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method MetricSet.Fetch should have comment or be unexported
*helper.HTTP | ||
} | ||
|
||
func New(base mb.BaseMetricSet) (mb.MetricSet, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function New should have comment or be unexported
} | ||
} | ||
|
||
type MetricSet struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type MetricSet should have comment or be unexported
@@ -0,0 +1,58 @@ | |||
package osd_df |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use an underscore in package name
Nodes []Node `json:"nodes"` | ||
} | ||
|
||
type OsdDfRequest struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type OsdDfRequest should have comment or be unexported
DeviceClass string `json:"device_class"` | ||
} | ||
|
||
type Output struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type Output should have comment or be unexported
"github.com/elastic/beats/libbeat/logp" | ||
) | ||
|
||
type Node struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type Node should have comment or be unexported
@@ -0,0 +1,61 @@ | |||
package osd_df |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use an underscore in package name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this contribution. It is great to see contributions of this quality with tests. I left a few minor comments. For the df -> filesystem
comment lets discuss first before you change anything. Not really sure about this one.
@@ -1192,6 +1192,83 @@ type: long | |||
Last updated | |||
|
|||
|
|||
[float] | |||
== osd_df fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that popped up in my head is that we have here df
and we have system.filesystem
with similar info. Don't know if osd_filesystem
would make sense here (even though pretty long).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the function of osd df in ceph is very similar with *system.filesystem * in linux. It shows osds' weight, reweight, size, used, avai and used pct information. Naming this new metricbet as osd_df is because it's a standard command in Ceph, and I consider that it will be much more familer to ceph users. For more about the command's detials:
http://docs.ceph.com/docs/master/man/8/ceph/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a similar discussion with the system module. Most sysadmins will be used to run the df
command. But someone consuming the data is more looking for information about the filesystem which could be a different person. TBH don't know which one is better. I'm fine moving forward with df
.
metricbeat/docs/fields.asciidoc
Outdated
|
||
|
||
[float] | ||
=== `ceph.osd_df.total_byte` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be ceph.osd_df.total.bytes
. have a look at the naming conventions: https://www.elastic.co/guide/en/beats/devguide/current/event-conventions.html Same applies to the fields below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will fix it.
metricbeat/docs/fields.asciidoc
Outdated
|
||
|
||
[float] | ||
=== `ceph.osd_df.avail_byte` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
available.bytes
: We prefer no abbreviations if not in the list.
metricbeat/docs/fields.asciidoc
Outdated
|
||
|
||
[float] | ||
=== `ceph.osd_df.used_pct` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used.pct
and you can use format: percent
so Kibana nows it's a percentage.
The type you can set to type: scaled_float
as this should be enough for percentages (normally)
@@ -0,0 +1,40 @@ | |||
- name: osd_df |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left the comments in the fields.asciidoc, but they should obviously go here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it. :)
//osd node list | ||
events := []common.MapStr{} | ||
for _, node := range nodeList { | ||
nodeInfo := common.MapStr{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could do here
nodeInfo := common.MapStr{
"id": node.ID,
"name": node.Name,
...
I think it would make the code a bit nicer (exact same outcome)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, your code looks much better. I will refine mine.
} | ||
|
||
func New(base mb.BaseMetricSet) (mb.MetricSet, error) { | ||
cfgwarn.Beta("The ceph osd_df metricset is beta") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we make this first experimental (as we do with all new metricsets first)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will change it to experimental metricbet.
It's weird, when I cd beats/metricbeat, and run make update, the metricbeat/docs/modules/ceph/osd_df.asciidoc file does not update automatically. And continuous-integration/travis-ci/pr build fail. |
That is strange. Can you run |
I run make clean , and then make update. My python version is: and virtualenv has been installed: Is there any log than I can see to check what is going wrong while executing make update command? |
Hm, that all looks good. Let me pull your branch and see what happens. In general |
@@ -0,0 +1,41 @@ | |||
- name: osd_df | |||
type: group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a new feature I just added recently. Could you add release: experimental
here? Like this you don't have to add it manually to the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will add it.
@@ -0,0 +1,3 @@ | |||
=== Ceph cluster_health metricset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this title can now be removed with our new script. Sorry missed that previously but realised it now that i checked out the branch locally.
Just did a pull and it gives me a diff for the asciidoc file. Perhaps what I posted above fixes it? |
@elaron Can you run |
OK, this is the output of make clean and make update: |
Hm, that looks exactly like what I would expect. What does |
git status shows that the osd_df branch is clean. [root@centos7gui metricbeat]# git status [root@centos7gui metricbeat]# cd ../ [root@centos7gui beats]# git status |
Could you show the |
Yes, please open a PR against my branch with the updates. I will merge them in. Thanks a lot. |
@elaron Ok, I fetched your branch and the issue seems to be that it's based on an older version of master. If I rebase on top of our most recent master, the update works as expected. We have now 2 options:
We could also merge master in if you prefer that over rebasing. Which path should we go? |
@ruflin , I rebase on master, then run make update and force push. Now all checks have passed. Should I update the CHANGELOG.asciidoc? |
@elaron Awesome, that looks very green. Yes can you push one more commit with the CHANGELOG entry? |
@ruflin CHANGELOG has been update. |
jenkins, test it |
@elaron Don't worry about the node_stats test. It's not related to this PR. |
OK, thanks a lot for your help. :) |
@elaron Merged. Thanks a lot for your contribution. |
It's my pleasure. |
osd_df will record each osd node's disk usage for ceph cluster.