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

fix(alerts): use mount point filters for disk space alerts #229

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

rikukissa
Copy link
Member

This is an improvement / fix to what we previously had as device names can really be anything. Previously we assumed a disk device name /dev/vdabut in many of our own VMs the device mounted to fs root is actually /dev/vda1.

Alerts are now connected to /hostfs and /hostfs/data
image

This is an improvement to what we previously had as device names can really be anything
Copy link
Collaborator

@makelicious makelicious left a comment

Choose a reason for hiding this comment

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

Let's check the min/max difference for alert. Unifications are nice to have

@@ -1,10 +1,10 @@
{"attributes":{"actions":[{"actionRef":"preconfigured:preconfigured-alert-history-es-index","actionTypeId":".index","group":"metrics.inventory_threshold.fired","params":{"documents":["{\"@timestamp\":\"2023-11-17T13:17:52.791Z\",\"tags\":\"{{rule.tags}}\",\"rule\":{\"id\":\"{{rule.id}}\",\"name\":\"{{rule.name}}\",\"params\":{\"{{rule__type}}\":\"{{params}}\"},\"space\":\"{{rule.spaceId}}\",\"type\":\"{{rule.type}}\"},\"kibana\":{\"alert\":{\"id\":\"{{alert.id}}\",\"context\":{\"{{rule__type}}\":\"{{context}}\"},\"actionGroup\":\"{{alert.actionGroup}}\",\"actionGroupName\":\"{{alert.actionGroupName}}\"}},\"event\":{\"kind\":\"alert\"}}"]}}],"alertTypeId":"metrics.alert.inventory.threshold","apiKey":null,"apiKeyOwner":null,"consumer":"alerts","createdAt":"2023-11-17T12:01:46.420Z","createdBy":"elastic","enabled":false,"executionStatus":{"error":null,"lastExecutionDate":"2024-02-07T08:28:08.400Z","status":"pending"},"legacyId":null,"meta":{"versionApiKeyLastmodified":"7.17.0"},"muteAll":false,"mutedInstanceIds":[],"name":"Available disk space in data partition","notifyWhen":"onActionGroupChange","params":{"criteria":[{"comparator":"<","customMetric":{"aggregation":"min","field":"system.filesystem.available","id":"alert-custom-metric","type":"custom"},"metric":"custom","threshold":[170000000000],"timeSize":1,"timeUnit":"h","warningComparator":"<","warningThreshold":[220000000000]}],"filterQuery":"{\"bool\":{\"should\":[{\"match_phrase\":{\"system.filesystem.device_name\":\"/dev/vda\"}}],\"minimum_should_match\":1}}","filterQueryText":"system.filesystem.device_name : \"/dev/vda\"","nodeType":"host","sourceId":"default"},"schedule":{"interval":"1h"},"scheduledTaskId":null,"tags":["infra","opencrvs-builtin"],"throttle":null,"updatedAt":"2024-02-07T02:27:29.567Z","updatedBy":"elastic"},"coreMigrationVersion":"7.17.0","id":"14778650-8541-11ee-9002-2f37fdc4e5d5","migrationVersion":{"alert":"7.16.0"},"references":[],"sort":[1707294424438,232754],"type":"alert","updated_at":"2024-02-07T08:27:04.438Z","version":"WzQ5NTQzMSwxOV0="}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might want to use different aggregator

customMetric": {
                        "aggregation": "min", <-- max here
                        "field": "system.filesystem.used.pct", <-- since this changed
                        "id": "alert-custom-metric",
                        "type": "custom"
                    },

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could unify the thresholds between the changed actions if they are arbitrary

// "Available disk space in root file system"
    "params": {
      "alertOnNoData": true, // <-- Could be unfied
      "criteria": [
        {
          "comparator": ">", // <-- Could be unified
          "customMetric": {
            "aggregation": "max",
            "field": "system.filesystem.used.pct",
            "id": "alert-custom-metric",
            "label": "",
            "type": "custom"
          },
          "metric": "custom",
          "threshold": [0.7], <-- Could be unified
          "timeSize": 1,
          "timeUnit": "h",
          "warningComparator": ">", // <-- Could be unified
          "warningThreshold": [0.5] // <-- Could be unified
        }
      ]
},
// "Low on available disk space in data partition"
    "params": {
      "criteria": [
        {
          "comparator": ">=", // <-- Could be unified
          "customMetric": {
            "aggregation": "min", <-- max
            "field": "system.filesystem.used.pct",
            "id": "alert-custom-metric",
            "type": "custom"
          },
          "metric": "custom",
          "threshold": [0.8],  // <-- Could be unified
          "timeSize": 1,
          "timeUnit": "h",
          "warningComparator": ">=", // <-- Could be unified
          "warningThreshold": [0.5] // <-- Could be unified
        }
      ]
    },

@rikukissa rikukissa added this to the v1.6.0 milestone Aug 6, 2024
@rikukissa rikukissa merged commit 13f0f2a into develop Aug 7, 2024
1 check passed
rikukissa added a commit that referenced this pull request Aug 7, 2024
@rikukissa rikukissa modified the milestones: v1.6.0, v1.5.0, v1.5.1 Aug 7, 2024
github-actions bot pushed a commit that referenced this pull request Aug 7, 2024
rikukissa added a commit that referenced this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Code Review
Development

Successfully merging this pull request may close these issues.

2 participants