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

[metricbeat]kubernetes cronjob through kube-state-metrics #13001

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16050,6 +16050,103 @@ format: bytes

--

[float]
=== state_cronjob

kubernetes cronjob metrics



*`kubernetes.state_cronjob.name`*::
+
--
Cronjob name

type: keyword

--

*`kubernetes.state_cronjob.namespace`*::
+
--
Cronjob namespace

type: keyword

--

*`kubernetes.state_cronjob.schedule`*::
+
--
Cronjob schedule

type: keyword

--

*`kubernetes.state_cronjob.concurrency`*::
+
--
Concurrency policy

type: keyword

--

*`kubernetes.state_cronjob.active.count`*::
+
--
Number of active pods for the cronjob

type: long

--

*`kubernetes.state_cronjob.is_suspended`*::
+
--
Whether the cronjob is suspended

type: boolean

--

*`kubernetes.state_cronjob.created.sec`*::
+
--
Epoch seconds since the cronjob was created

type: double

--

*`kubernetes.state_cronjob.lastschedule.sec`*::
+
--
Epoch seconds for last cronjob run

type: double

--

*`kubernetes.state_cronjob.nextschedule.sec`*::
+
--
Epoch seconds for next cronjob run

type: double

--

*`kubernetes.state_cronjob.deadline.sec`*::
+
--
Deadline seconds after schedule for considering failed

type: long

--

[float]
=== deployment

Expand Down
5 changes: 5 additions & 0 deletions metricbeat/docs/modules/kubernetes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ metricbeat.modules:
- state_statefulset
- state_pod
- state_container
- state_cronjob
period: 10s
hosts: ["kube-state-metrics:8080"]

Expand Down Expand Up @@ -170,6 +171,8 @@ The following metricsets are available:

* <<metricbeat-metricset-kubernetes-state_container,state_container>>

* <<metricbeat-metricset-kubernetes-state_cronjob,state_cronjob>>

* <<metricbeat-metricset-kubernetes-state_deployment,state_deployment>>

* <<metricbeat-metricset-kubernetes-state_node,state_node>>
Expand Down Expand Up @@ -202,6 +205,8 @@ include::kubernetes/scheduler.asciidoc[]

include::kubernetes/state_container.asciidoc[]

include::kubernetes/state_cronjob.asciidoc[]

include::kubernetes/state_deployment.asciidoc[]

include::kubernetes/state_node.asciidoc[]
Expand Down
23 changes: 23 additions & 0 deletions metricbeat/docs/modules/kubernetes/state_cronjob.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
////
This file is generated! See scripts/mage/docs_collector.go
////

[[metricbeat-metricset-kubernetes-state_cronjob]]
=== Kubernetes state_cronjob metricset

beta[]

include::../../../module/kubernetes/state_cronjob/_meta/docs.asciidoc[]


==== Fields

For a description of each field in the metricset, see the
<<exported-fields-kubernetes,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../module/kubernetes/state_cronjob/_meta/data.json[]
----
3 changes: 2 additions & 1 deletion metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ This file is generated! See scripts/mage/docs_collector.go
.2+| .2+| |<<metricbeat-metricset-kibana-stats,stats>>
|<<metricbeat-metricset-kibana-status,status>>
|<<metricbeat-module-kubernetes,Kubernetes>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.16+| .16+| |<<metricbeat-metricset-kubernetes-apiserver,apiserver>>
.17+| .17+| |<<metricbeat-metricset-kubernetes-apiserver,apiserver>>
|<<metricbeat-metricset-kubernetes-container,container>>
|<<metricbeat-metricset-kubernetes-controllermanager,controllermanager>> beta[]
|<<metricbeat-metricset-kubernetes-event,event>>
Expand All @@ -95,6 +95,7 @@ This file is generated! See scripts/mage/docs_collector.go
|<<metricbeat-metricset-kubernetes-proxy,proxy>> beta[]
|<<metricbeat-metricset-kubernetes-scheduler,scheduler>> beta[]
|<<metricbeat-metricset-kubernetes-state_container,state_container>>
|<<metricbeat-metricset-kubernetes-state_cronjob,state_cronjob>> beta[]
|<<metricbeat-metricset-kubernetes-state_deployment,state_deployment>>
|<<metricbeat-metricset-kubernetes-state_node,state_node>>
|<<metricbeat-metricset-kubernetes-state_pod,state_pod>>
Expand Down
1 change: 1 addition & 0 deletions metricbeat/include/list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ metricbeat.modules:
- state_statefulset
- state_pod
- state_container
- state_cronjob
period: 10s
hosts: ["kube-state-metrics:8080"]

Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/kubernetes/_meta/config.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- state_statefulset
- state_pod
- state_container
- state_cronjob
period: 10s
hosts: ["kube-state-metrics:8080"]

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/kubernetes/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions metricbeat/module/kubernetes/state_cronjob/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Kube-state-metrics/Cronjob

## Version history

- July 2019, `v1.7.0`

## Resources

Docs for 1.7 release of `kube-state-metrics` cronjobs can be found here:
https://github.com/kubernetes/kube-state-metrics/blob/release-1.7/docs/cronjob-metrics.md

## Metrics insight

- kube_cronjob_labels{namespace,cronjob,label_run} Gauge

Need to modify prometheus thing to be able to read this
*Not added yet!*

- kube_cronjob_info{namespace,cronjob,schedule=,concurrency_policy} Gauge

- kube_cronjob_created{namespace,cronjob} Gauge

Unix time

- kube_cronjob_status_active{namespace,cronjob} Gauge

Contains the number of active pods working for this cronjob, will usually be 0 or 1, but I think this could be more than 1

- kube_cronjob_status_last_schedule_time{namespace,cronjob} Gauge

Unix time

- kube_cronjob_spec_suspend{namespace,cronjob} Gauge

- kube_cronjob_spec_starting_deadline_seconds{namespace,cronjob} Gauge

RE-TEST -- add deadline

- kube_cronjob_next_schedule_time{namespace,cronjob} Gauge

Unix time

- kube_cronjob_annotations{namespace="default",cronjob="bye"}

Marked as experimental
*Not added yet!*

## Setup environment for manual tests


Instructions for `Linux` and `Kind`. If you are using any other environment and need to adapt these instructions, please, update accordingly.

TODO
odacremolbap marked this conversation as resolved.
Show resolved Hide resolved












3 changes: 3 additions & 0 deletions metricbeat/module/kubernetes/state_cronjob/_meta/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the `state_cronjob` metricset of the Kubernetes module.
44 changes: 44 additions & 0 deletions metricbeat/module/kubernetes/state_cronjob/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
- name: state_cronjob
type: group
description: >
kubernetes cronjob metrics
release: beta
fields:
- name: name
type: keyword
description: Cronjob name
- name: namespace
type: keyword
description: Cronjob namespace
- name: schedule
type: keyword
description: Cronjob schedule
- name: concurrency
type: keyword
description: Concurrency policy
- name: active.count
type: long
description: Number of active pods for the cronjob
- name: is_suspended
type: boolean
description: Whether the cronjob is suspended
- name: created.sec
type: double
description: Epoch seconds since the cronjob was created
- name: lastschedule.sec
odacremolbap marked this conversation as resolved.
Show resolved Hide resolved
type: double
description: Epoch seconds for last cronjob run
- name: nextschedule.sec
odacremolbap marked this conversation as resolved.
Show resolved Hide resolved
type: double
description: Epoch seconds for next cronjob run
- name: deadline.sec
type: long
description: Deadline seconds after schedule for considering failed








Loading