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

[vSphere] add triggered alarm to existing metricsets. #40714

Merged
merged 15 commits into from
Sep 13, 2024

Conversation

niraj-elastic
Copy link
Contributor

@niraj-elastic niraj-elastic commented Sep 9, 2024

Description

Added alert.names field to fetch information related to alert in all the metricsets.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@niraj-elastic niraj-elastic self-assigned this Sep 9, 2024
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 9, 2024
Copy link
Contributor

mergify bot commented Sep 9, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @niraj-elastic? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@ishleenk17
Copy link
Contributor

@niraj-elastic : Can we please keep this change for just the alarms as we have to do it for all metricsets. It becomes difficult to review otherwise.
Also, please add the sample event.

Copy link
Contributor

mergify bot commented Sep 10, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b vsphere_add_alerts_metrics upstream/vsphere_add_alerts_metrics
git merge upstream/main
git push upstream vsphere_add_alerts_metrics

@niraj-elastic niraj-elastic added enhancement Metricbeat Metricbeat and removed needs_team Indicates that the issue/PR needs a Team:* label labels Sep 10, 2024
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 10, 2024
@niraj-elastic niraj-elastic added the Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team label Sep 10, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 10, 2024
@niraj-elastic niraj-elastic marked this pull request as ready for review September 10, 2024 15:06
@niraj-elastic niraj-elastic requested a review from a team as a code owner September 10, 2024 15:06
@ishleenk17
Copy link
Contributor

Please update sample jsons of all the metricsets.

Copy link
Contributor

mergify bot commented Sep 11, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b vsphere_add_alerts_metrics upstream/vsphere_add_alerts_metrics
git merge upstream/main
git push upstream vsphere_add_alerts_metrics

…phere_add_alerts_metrics

Conflicts:
	metricbeat/module/vsphere/datastore/datastore.go
	metricbeat/module/vsphere/host/host.go
Copy link
Contributor

mergify bot commented Sep 11, 2024

backport-8.x has been added to help with the transition to the new branch 8.x.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Sep 11, 2024
@v1v v1v removed the backport-v8.x label Sep 11, 2024
@niraj-elastic niraj-elastic changed the title [vSphere] add alert names to existing metricsets. [vSphere] add triggered alarm to existing metricsets. Sep 11, 2024
for _, alarmState := range triggeredAlarmState {
var triggeredAlarm triggerdAlarm
var alarm mo.Alarm
err := pc.RetrieveOne(ctx, alarmState.Alarm, nil, &alarm)
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the alarm state being compared to red "critical alarms ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ishleenk17 As we discussed yesterday, we will fetch all the triggered alarms and ingest them, filtering will be done in pipeline of kibana.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we able to access triggered_alarms.state in the triggered alarms object, if user wants to get only red alarms there?
Can you share here the processor
We will be able to do it in ingest pipeline in Integrations.
Are we mentioning somewhere which processors can they use to achieve the same result in beats ?

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 i have tried to access triggered_alarm.state and fetch red alarms.

In beats also Processors are supported which can be used to fetch red alarms. user can use something like script processor.

{
"name": "Host memory usage",
"id": "alarm-4.host-12",
"status": "yellow",
Copy link
Contributor

Choose a reason for hiding this comment

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

We should list only the critical alarms, yellow ones should not be listed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can filleter out yellow ones by using pipeline in kibana. we have kept the yellow ones as well so that in future we don't have to update vshphere metricsets to add yellow alarms if customer requires it.

Copy link
Collaborator

@kush-elastic kush-elastic left a comment

Choose a reason for hiding this comment

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

LGTM!

@ishleenk17
Copy link
Contributor

Can we update data.json of other metricsets also with dummy values is also fine.
We can use the same format from host for which we got the alarms.

Copy link
Contributor

mergify bot commented Sep 13, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b vsphere_add_alerts_metrics upstream/vsphere_add_alerts_metrics
git merge upstream/main
git push upstream vsphere_add_alerts_metrics

@ishleenk17
Copy link
Contributor

ishleenk17 commented Sep 13, 2024

Can we update data.json of other metricsets also with dummy values is also fine. We can use the same format from host for which we got the alarms.

The changes look fine.
We can ad that to future tasks to update alarms in data.json for other metricsets as well.

…phere_add_alerts_metrics

Conflicts:
	metricbeat/module/vsphere/datastore/datastore.go
	metricbeat/module/vsphere/fields.go
	metricbeat/module/vsphere/host/host.go
	metricbeat/module/vsphere/virtualmachine/virtualmachine.go
@ishleenk17 ishleenk17 merged commit 885a2db into elastic:main Sep 13, 2024
29 checks passed
mergify bot pushed a commit that referenced this pull request Sep 13, 2024
* add alert names

* update host metricset

* add alert metrics to all the metricsets

* add changelog entry

* update data_test

* add triggerd alarms

* added entity name

* mage check

---------

Co-authored-by: Niraj Rathod <niraj.rathod@crestdatasys.com>
Co-authored-by: Kush Rana <kush.rana@elastic.co>
Co-authored-by: harnish-elastic <harnish.chavda@elastic.co>
(cherry picked from commit 885a2db)

# Conflicts:
#	metricbeat/module/vsphere/datastore/datastore.go
#	metricbeat/module/vsphere/datastorecluster/datastorecluster.go
#	metricbeat/module/vsphere/fields.go
#	metricbeat/module/vsphere/host/host.go
#	metricbeat/module/vsphere/virtualmachine/virtualmachine.go
@ishleenk17 ishleenk17 added the backport-8.15 Automated backport to the 8.15 branch with mergify label Sep 15, 2024
mergify bot pushed a commit that referenced this pull request Sep 15, 2024
* add alert names

* update host metricset

* add alert metrics to all the metricsets

* add changelog entry

* update data_test

* add triggerd alarms

* added entity name

* mage check

---------

Co-authored-by: Niraj Rathod <niraj.rathod@crestdatasys.com>
Co-authored-by: Kush Rana <kush.rana@elastic.co>
Co-authored-by: harnish-elastic <harnish.chavda@elastic.co>
(cherry picked from commit 885a2db)
ishleenk17 added a commit that referenced this pull request Sep 16, 2024
…ricsets. (#40835)

* [vSphere] add triggered alarm to existing metricsets. (#40714)

* add alert names

* update host metricset

* add alert metrics to all the metricsets

* add changelog entry

* update data_test

* add triggerd alarms

* added entity name

* mage check

---------

Co-authored-by: Niraj Rathod <niraj.rathod@crestdatasys.com>
Co-authored-by: Kush Rana <kush.rana@elastic.co>
Co-authored-by: harnish-elastic <harnish.chavda@elastic.co>
(cherry picked from commit 885a2db)

* Address CI issue

---------

Co-authored-by: niraj-elastic <124254029+niraj-elastic@users.noreply.github.com>
Co-authored-by: ishleenk17 <ishleen.kaur@elastic.co>
kush-elastic added a commit that referenced this pull request Oct 1, 2024
…icsets. (#40812)

* [vSphere] add triggered alarm to existing metricsets. (#40714)

* add alert names

* update host metricset

* add alert metrics to all the metricsets

* add changelog entry

* update data_test

* add triggerd alarms

* added entity name

* mage check

---------

Co-authored-by: Niraj Rathod <niraj.rathod@crestdatasys.com>
Co-authored-by: Kush Rana <kush.rana@elastic.co>
Co-authored-by: harnish-elastic <harnish.chavda@elastic.co>
(cherry picked from commit 885a2db)

# Conflicts:
#	metricbeat/module/vsphere/datastore/datastore.go
#	metricbeat/module/vsphere/datastorecluster/datastorecluster.go
#	metricbeat/module/vsphere/fields.go
#	metricbeat/module/vsphere/host/host.go
#	metricbeat/module/vsphere/virtualmachine/virtualmachine.go

* fix existing conflicts

* fix changelog entry

---------

Co-authored-by: niraj-elastic <124254029+niraj-elastic@users.noreply.github.com>
Co-authored-by: Kush Rana <89848966+kush-elastic@users.noreply.github.com>
Co-authored-by: Kush Rana <kush.rana@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.15 Automated backport to the 8.15 branch with mergify enhancement Metricbeat Metricbeat Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants