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

Add ceph osd_df to metricbeat #5606

Merged
merged 8 commits into from
Dec 1, 2017
Merged

Add ceph osd_df to metricbeat #5606

merged 8 commits into from
Dec 1, 2017

Conversation

elaron
Copy link
Contributor

@elaron elaron commented Nov 16, 2017

osd_df will record each osd node's disk usage for ceph cluster.

@elasticmachine
Copy link
Collaborator

Can one of the admins verify this patch?

@@ -0,0 +1,63 @@
package osd_df

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

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) {

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) {

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 {

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

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 {

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 {

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 {

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

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

Copy link
Member

@ruflin ruflin left a 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
Copy link
Member

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).

Copy link
Contributor Author

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/

Copy link
Member

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.



[float]
=== `ceph.osd_df.total_byte`
Copy link
Member

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.

Copy link
Contributor Author

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.



[float]
=== `ceph.osd_df.avail_byte`
Copy link
Member

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.



[float]
=== `ceph.osd_df.used_pct`
Copy link
Member

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
Copy link
Member

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.

Copy link
Contributor Author

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{}
Copy link
Member

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)

Copy link
Contributor Author

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")
Copy link
Member

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)

Copy link
Contributor Author

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.

@elaron
Copy link
Contributor Author

elaron commented Nov 23, 2017

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.

@ruflin
Copy link
Member

ruflin commented Nov 26, 2017

That is strange. Can you run make clean and then run make update again? Make sure that if you run make status all files are added.

@elaron
Copy link
Contributor Author

elaron commented Nov 27, 2017

I run make clean , and then make update.
But asciidoc file cannot update automatically.

My python version is:
[root@centos7gui metricbeat]# python
Python 2.7.12 (default, Nov 16 2017, 11:01:26)

and virtualenv has been installed:
[root@centos7gui metricbeat]# virtualenv
You must provide a DEST_DIR
Usage: virtualenv [OPTIONS] DEST_DIR

Is there any log than I can see to check what is going wrong while executing make update command?

@ruflin
Copy link
Member

ruflin commented Nov 27, 2017

Hm, that all looks good. Let me pull your branch and see what happens. In general make update should tell you what went wrong.

@@ -0,0 +1,41 @@
- name: osd_df
type: group
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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.

@ruflin
Copy link
Member

ruflin commented Nov 27, 2017

Just did a pull and it gives me a diff for the asciidoc file. Perhaps what I posted above fixes it?

@ruflin
Copy link
Member

ruflin commented Nov 27, 2017

@elaron Can you run make update and paste the output here?

@elaron
Copy link
Contributor Author

elaron commented Nov 27, 2017

OK, this is the output of make clean and make update:
[root@centos7gui metricbeat]# make clean
[root@centos7gui metricbeat]# make update
Using base prefix '/usr/local'
New python executable in /root/Projects/go/src/github.com/elastic/beats/metricbeat/build/python-env/bin/python3.5
Also creating executable in /root/Projects/go/src/github.com/elastic/beats/metricbeat/build/python-env/bin/python
Installing setuptools, pip, wheel...done.
Updating generated files for metricbeat
make[1]: 进入目录“/root/Projects/go/src/github.com/elastic/beats/libbeat”
make[1]: 离开目录“/root/Projects/go/src/github.com/elastic/beats/libbeat”
-- The index pattern was created under /root/Projects/go/src/github.com/elastic/beats/metricbeat/_meta/kibana/5.x/index-pattern/metricbeat.json
-- The index pattern was created under /root/Projects/go/src/github.com/elastic/beats/metricbeat/_meta/kibana/default/index-pattern/metricbeat.json
[root@centos7gui metricbeat]#

@ruflin
Copy link
Member

ruflin commented Nov 27, 2017

Hm, that looks exactly like what I would expect. What does git status show? Otherwise perhaps run make clean and make update in the beats directory and check again git status, this will take a bit of time.

@elaron
Copy link
Contributor Author

elaron commented Nov 27, 2017

git status shows that the osd_df branch is clean.
After running make clean and make update in beats directory, it shows that packetbeat/docs/fields.asciidoc has been updated.

[root@centos7gui metricbeat]# git status
# 位于分支 osd_df
无文件要提交,干净的工作区

[root@centos7gui metricbeat]# cd ../
[root@centos7gui beats]# make clean;make update;
//.... takes a while ...

[root@centos7gui beats]# git status
# 位于分支 osd_df
# 尚未暂存以备提交的变更:
# (使用 "git add ..." 更新要提交的内容)
# (使用 "git checkout -- ..." 丢弃工作区的改动)
#
# 修改: packetbeat/docs/fields.asciidoc
#
修改尚未加入提交(使用 "git add" 和/或 "git commit -a")

@ruflin
Copy link
Member

ruflin commented Nov 27, 2017

Could you show the git diff output? Otherwise what do you think if I open a PR against your branch with the update so you can merge it in and we can get the PR in. Not sure what is happening here.

@elaron
Copy link
Contributor Author

elaron commented Nov 28, 2017

Yes, please open a PR against my branch with the updates. I will merge them in. Thanks a lot.

@ruflin
Copy link
Member

ruflin commented Nov 28, 2017

@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:

  • You rebase on master, run make update and force push
  • I force push to your branch :-(

We could also merge master in if you prefer that over rebasing.

Which path should we go?

@elaron
Copy link
Contributor Author

elaron commented Nov 29, 2017

@ruflin , I rebase on master, then run make update and force push. Now all checks have passed.

Should I update the CHANGELOG.asciidoc?

@ruflin
Copy link
Member

ruflin commented Nov 30, 2017

@elaron Awesome, that looks very green. Yes can you push one more commit with the CHANGELOG entry?

@elaron
Copy link
Contributor Author

elaron commented Nov 30, 2017

@ruflin CHANGELOG has been update.
But it's strange that the CI failed, because some kinds of logstash test case error?
"FAIL: logstash node_stats metricset test"

@ruflin
Copy link
Member

ruflin commented Nov 30, 2017

jenkins, test it

@ruflin
Copy link
Member

ruflin commented Nov 30, 2017

@elaron Don't worry about the node_stats test. It's not related to this PR.

@elaron
Copy link
Contributor Author

elaron commented Dec 1, 2017

OK, thanks a lot for your help. :)

@ruflin ruflin merged commit 9bb8617 into elastic:master Dec 1, 2017
@ruflin
Copy link
Member

ruflin commented Dec 1, 2017

@elaron Merged. Thanks a lot for your contribution.

@elaron elaron deleted the osd_df branch December 1, 2017 01:57
@elaron
Copy link
Contributor Author

elaron commented Dec 1, 2017

It's my pleasure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants