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 tree infomation to metricbeat #5498

Merged
merged 8 commits into from
Nov 10, 2017
Merged

Conversation

elaron
Copy link
Contributor

@elaron elaron commented Nov 2, 2017

This PR is trying to collect the osd tree infomation of a ceph cluster. The osd tree infomation is important for understanding and monitoring the structure of a ceph cluster.

In this PR, the code will collect all the osd nodes' weight, status, primary_affinity and other usefull info.

@elasticmachine
Copy link
Collaborator

Can one of the admins verify this patch?

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! 🎉 I made some comments on fields.yml, also feel free to add a changelog line :)

description: >
node depth
- name: exists
type: long
Copy link
Contributor

Choose a reason for hiding this comment

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

this could be a boolean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi, I have update the fields.yml and the changelog.

description: >
osd or bucket node id
- name: name
type: string
Copy link
Contributor

Choose a reason for hiding this comment

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

This can either be keyword or text. You want to use keyword on fields like this, with a limited number of possible values, and text for free form strings

@elaron
Copy link
Contributor Author

elaron commented Nov 2, 2017

Is there any way for me to change the modules.d/ceph.yaml.disabled file, and add "osd_tree" as one of the monitor options like this:
metricsets: ["cluster_disk", "cluster_health", "monitor_health", "pool_disk", "osd_tree"]

@andrewkroh
Copy link
Member

Yes, modify metricbeat/module/ceph/_meta/config.yml then run make update.

@elaron
Copy link
Contributor Author

elaron commented Nov 4, 2017

@exekias fileds.yml has been update, please check~

[float]
=== `ceph.osd_tree.children`

type: string
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be keyword?

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 children is a list of children nodes, I don't think it is keyword type.

Copy link
Contributor

Choose a reason for hiding this comment

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

How are children named? It should be either keyword or text. Have a look to ES documentation:https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html: In Elasticsearch, there is no dedicated array type. Any field can contain zero or more values by default, however, all values in the array must be of the same datatype

Copy link
Contributor Author

Choose a reason for hiding this comment

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

children list is a ID list seperated by comma, looks like:
"children": "4,3,1,0"
I think it's much more like text. I will change its type from string to text.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah thank you, I understand it now, would it make sense to split that string into an array of keywords?

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 I display this children list in Grafana as a text, seems like there's no need to make them into an array of keyword now. If there's a need to make them into array in the future, I will pull a patch for it.

[float]
=== `ceph.osd_tree.father`

type: string
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this should be keyword

Copy link
Contributor Author

Choose a reason for hiding this comment

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

father is the parent node's name, it could be keyword, I will fix it.

[float]
=== `ceph.osd_tree.status`

type: string
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be keyword

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, it is, I will fix it.

@@ -0,0 +1,88 @@
package osd_tree

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_tree

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

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

Id int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
TypeId int64 `json:"type_id"`

Choose a reason for hiding this comment

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

struct field TypeId should be TypeID

)

type Node struct {
Id int64 `json:"id"`

Choose a reason for hiding this comment

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

struct field Id should be ID

"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,99 @@
package osd_tree

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

@exekias
Copy link
Contributor

exekias commented Nov 7, 2017

We just enabled hound, please don't take everything it says as mandatory, we are still testing the platform

@elaron
Copy link
Contributor Author

elaron commented Nov 7, 2017

ok, I will just update "Id" to "ID", seems it looks much more unified.

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

Waiting for green

@exekias exekias merged commit 81bd9c6 into elastic:master Nov 10, 2017
@exekias
Copy link
Contributor

exekias commented Nov 10, 2017

Thank you again! you rock 🎉

@elaron elaron deleted the osd_tree branch November 13, 2017 07:59
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.

5 participants