Skip to content

Instantly share code, notes, and snippets.

@embano1
Last active April 12, 2021 10:29
Show Gist options
  • Select an option

  • Save embano1/d7c55ab399aa62d77498d2dd2e1da7fa to your computer and use it in GitHub Desktop.

Select an option

Save embano1/d7c55ab399aa62d77498d2dd2e1da7fa to your computer and use it in GitHub Desktop.

Example vSphere Alarm events sent from VMware Event Router and enriched with the vSphere Alarm Server

AlarmStatusChangedEvent Datastore Disk Usage

Configuration rule in UI: "IF Datastore Disk Usage IS ABOVE 5% TRIGGER THE ALARM AND Show as Warning"

Metadata

id:
f6822b36-5372-402f-b21a-238c20901685
knativearrivaltime:
2021-04-12T10:15:22.310218901Z
source:
https://10.192.197.58/sdk
subject:
AlarmStatusChangedEvent
time:
2021-04-12T10:15:22.299348319Z
type:
com.vmware.event.router/event.AlarmInfo

Data

{
  "Key": 10566,
  "ChainId": 10566,
  "CreatedTime": "2021-04-12T10:15:21.733Z",
  "UserName": "",
  "Datacenter": {
    "Name": "vcqaDC",
    "Datacenter": {
      "Type": "Datacenter",
      "Value": "datacenter-2"
    }
  },
  "ComputeResource": null,
  "Host": null,
  "Vm": null,
  "Ds": {
    "Name": "sharedVmfs-0",
    "Datastore": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "Net": null,
  "Dvs": null,
  "FullFormattedMessage": "Alarm 'custom-usage-alert-1' on sharedVmfs-0 changed from Gray to Yellow",
  "ChangeTag": "",
  "Alarm": {
    "Name": "custom-usage-alert-1",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-284"
    }
  },
  "Source": {
    "Name": "sharedVmfs-0",
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "Entity": {
    "Name": "sharedVmfs-0",
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "From": "gray",
  "To": "yellow",
  "AlarmInfo": {
    "Name": "custom-usage-alert-1",
    "SystemName": "",
    "Description": "Threshold intentionally set very low to do a demo",
    "Enabled": true,
    "Expression": {
      "Expression": [
        {
          "Operator": "isAbove",
          "Type": "Datastore",
          "Metric": {
            "CounterId": 266,
            "Instance": ""
          },
          "Yellow": 500,
          "YellowInterval": 0,
          "Red": 0,
          "RedInterval": 0
        }
      ]
    },
    "Action": null,
    "ActionFrequency": 0,
    "Setting": {
      "ToleranceRange": 0,
      "ReportingFrequency": 300
    },
    "Key": "",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-284"
    },
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    },
    "LastModifiedTime": "2021-04-12T09:49:13.835363Z",
    "LastModifiedUser": "VSPHERE.LOCAL\\Administrator",
    "CreationEventId": 0
  }
}

AlarmStatusChangedEvent VM CPU Usage

Metadata

id:
366f5cd3-4c78-4685-9c72-d7b845be5660
knativearrivaltime:
2021-04-12T10:04:02.029831166Z
source:
https://10.192.197.58/sdk
time:
2021-04-12T10:04:02.0264983Z
type:
com.vmware.event.router/event.AlarmInfo
subject:
AlarmStatusChangedEvent

Data

{
  "Key": 10526,
  "ChainId": 10526,
  "CreatedTime": "2021-04-12T10:03:59.356999Z",
  "UserName": "",
  "Datacenter": {
    "Name": "vcqaDC",
    "Datacenter": {
      "Type": "Datacenter",
      "Value": "datacenter-2"
    }
  },
  "ComputeResource": {
    "Name": "cls",
    "ComputeResource": {
      "Type": "ClusterComputeResource",
      "Value": "domain-c7"
    }
  },
  "Host": {
    "Name": "10.192.202.3",
    "Host": {
      "Type": "HostSystem",
      "Value": "host-15"
    }
  },
  "Vm": {
    "Name": "test-01",
    "Vm": {
      "Type": "VirtualMachine",
      "Value": "vm-56"
    }
  },
  "Ds": null,
  "Net": null,
  "Dvs": null,
  "FullFormattedMessage": "Alarm 'Virtual machine CPU usage' on test-01 changed from Gray to Green",
  "ChangeTag": "",
  "Alarm": {
    "Name": "Virtual machine CPU usage",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-5"
    }
  },
  "Source": {
    "Name": "Datacenters",
    "Entity": {
      "Type": "Folder",
      "Value": "group-d1"
    }
  },
  "Entity": {
    "Name": "test-01",
    "Entity": {
      "Type": "VirtualMachine",
      "Value": "vm-56"
    }
  },
  "From": "gray",
  "To": "green",
  "AlarmInfo": {
    "Name": "Virtual machine CPU usage",
    "SystemName": "alarm.VmCPUUsageAlarm",
    "Description": "Default alarm to monitor virtual machine CPU usage",
    "Enabled": true,
    "Expression": {
      "Expression": [
        {
          "Operator": "isAbove",
          "Type": "VirtualMachine",
          "Metric": {
            "CounterId": 2,
            "Instance": ""
          },
          "Yellow": 7500,
          "YellowInterval": 300,
          "Red": 9000,
          "RedInterval": 300
        }
      ]
    },
    "Action": null,
    "ActionFrequency": 0,
    "Setting": {
      "ToleranceRange": 0,
      "ReportingFrequency": 300
    },
    "Key": "",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-5"
    },
    "Entity": {
      "Type": "Folder",
      "Value": "group-d1"
    },
    "LastModifiedTime": "2021-03-30T09:59:19.064217Z",
    "LastModifiedUser": "",
    "CreationEventId": 0
  }
}

AlarmReconfiguredEvent (disable an Alarm)

Metadata

id:
d528dbd5-738a-4666-a6a2-aa86acf03791
knativearrivaltime:
2021-04-12T10:13:22.018461269Z
source:
https://10.192.197.58/sdk
subject:
AlarmReconfiguredEvent
time:
2021-04-12T10:13:22.010562575Z
type:
com.vmware.event.router/event.AlarmInfo

Data

{
  "Key": 10558,
  "ChainId": 10557,
  "CreatedTime": "2021-04-12T10:13:21.234999Z",
  "UserName": "VSPHERE.LOCAL\\Administrator",
  "Datacenter": {
    "Name": "vcqaDC",
    "Datacenter": {
      "Type": "Datacenter",
      "Value": "datacenter-2"
    }
  },
  "ComputeResource": null,
  "Host": null,
  "Vm": null,
  "Ds": {
    "Name": "sharedVmfs-0",
    "Datastore": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "Net": null,
  "Dvs": null,
  "FullFormattedMessage": "Reconfigured alarm 'custom-usage-alert-1' on sharedVmfs-0.  \n \nModified:  \n \ninfo.enabled: true -> false; \n\n Added:  \n \n Deleted:  \n \n.",
  "ChangeTag": "",
  "Alarm": {
    "Name": "custom-usage-alert-1",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-284"
    }
  },
  "Entity": {
    "Name": "sharedVmfs-0",
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "ConfigChanges": {
    "Modified": "info.enabled: true -> false; \n\n",
    "Added": "",
    "Deleted": ""
  },
  "AlarmInfo": {
    "Name": "custom-usage-alert-1",
    "SystemName": "",
    "Description": "Threshold intentionally set very low to do a demo",
    "Enabled": true,
    "Expression": {
      "Expression": [
        {
          "Operator": "isAbove",
          "Type": "Datastore",
          "Metric": {
            "CounterId": 266,
            "Instance": ""
          },
          "Yellow": 500,
          "YellowInterval": 0,
          "Red": 0,
          "RedInterval": 0
        }
      ]
    },
    "Action": null,
    "ActionFrequency": 0,
    "Setting": {
      "ToleranceRange": 0,
      "ReportingFrequency": 300
    },
    "Key": "",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-284"
    },
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    },
    "LastModifiedTime": "2021-04-12T09:49:13.835363Z",
    "LastModifiedUser": "VSPHERE.LOCAL\\Administrator",
    "CreationEventId": 0
  }
}

AlarmAcknowledgedEvent

Metadata

id:
f0266f5c-6fea-4fb6-9d26-ebc61bf7789b
knativearrivaltime:
2021-04-12T10:17:29.367076637Z
source:
https://10.192.197.58/sdk
subject:
AlarmAcknowledgedEvent
time:
2021-04-12T10:17:29.352809609Z
type:
com.vmware.event.router/event.AlarmInfo

Data

{
  "Key": 10570,
  "ChainId": 10570,
  "CreatedTime": "2021-04-12T10:17:28.307999Z",
  "UserName": "VSPHERE.LOCAL\\Administrator",
  "Datacenter": {
    "Name": "vcqaDC",
    "Datacenter": {
      "Type": "Datacenter",
      "Value": "datacenter-2"
    }
  },
  "ComputeResource": null,
  "Host": null,
  "Vm": null,
  "Ds": {
    "Name": "sharedVmfs-0",
    "Datastore": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "Net": null,
  "Dvs": null,
  "FullFormattedMessage": "Acknowledged alarm 'custom-usage-alert-1' on sharedVmfs-0",
  "ChangeTag": "",
  "Alarm": {
    "Name": "custom-usage-alert-1",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-284"
    }
  },
  "Source": {
    "Name": "sharedVmfs-0",
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "Entity": {
    "Name": "sharedVmfs-0",
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "AlarmInfo": {
    "Name": "custom-usage-alert-1",
    "SystemName": "",
    "Description": "Threshold intentionally set very low to do a demo",
    "Enabled": true,
    "Expression": {
      "Expression": [
        {
          "Operator": "isAbove",
          "Type": "Datastore",
          "Metric": {
            "CounterId": 266,
            "Instance": ""
          },
          "Yellow": 500,
          "YellowInterval": 0,
          "Red": 0,
          "RedInterval": 0
        }
      ]
    },
    "Action": null,
    "ActionFrequency": 0,
    "Setting": {
      "ToleranceRange": 0,
      "ReportingFrequency": 300
    },
    "Key": "",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-284"
    },
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    },
    "LastModifiedTime": "2021-04-12T09:49:13.835363Z",
    "LastModifiedUser": "VSPHERE.LOCAL\\Administrator",
    "CreationEventId": 0
  }
}

AlarmClearedEvent (reset to green)

Note: clearing an alarm will also create another AlarmStatusChangedEvent ("from X to Green")

Metadata

id:
a9f5e4bc-3041-4ad6-a481-e143bd40ae36
knativearrivaltime:
2021-04-12T10:19:55.093552132Z
source:
https://10.192.197.58/sdk
subject:
AlarmClearedEvent
time:
2021-04-12T10:19:55.09184347Z
type:
com.vmware.event.router/event.AlarmInfo

Data

{
  "Key": 10584,
  "ChainId": 10584,
  "CreatedTime": "2021-04-12T10:19:54.378999Z",
  "UserName": "VSPHERE.LOCAL\\Administrator",
  "Datacenter": {
    "Name": "vcqaDC",
    "Datacenter": {
      "Type": "Datacenter",
      "Value": "datacenter-2"
    }
  },
  "ComputeResource": null,
  "Host": null,
  "Vm": null,
  "Ds": {
    "Name": "sharedVmfs-0",
    "Datastore": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "Net": null,
  "Dvs": null,
  "FullFormattedMessage": "Manually cleared alarm 'custom-usage-alert-1' on sharedVmfs-0 from Yellow",
  "ChangeTag": "",
  "Alarm": {
    "Name": "custom-usage-alert-1",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-284"
    }
  },
  "Source": {
    "Name": "sharedVmfs-0",
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "Entity": {
    "Name": "sharedVmfs-0",
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    }
  },
  "From": "yellow",
  "AlarmInfo": {
    "Name": "custom-usage-alert-1",
    "SystemName": "",
    "Description": "Threshold intentionally set very low to do a demo",
    "Enabled": true,
    "Expression": {
      "Expression": [
        {
          "Operator": "isAbove",
          "Type": "Datastore",
          "Metric": {
            "CounterId": 266,
            "Instance": ""
          },
          "Yellow": 500,
          "YellowInterval": 0,
          "Red": 0,
          "RedInterval": 0
        }
      ]
    },
    "Action": null,
    "ActionFrequency": 0,
    "Setting": {
      "ToleranceRange": 0,
      "ReportingFrequency": 300
    },
    "Key": "",
    "Alarm": {
      "Type": "Alarm",
      "Value": "alarm-284"
    },
    "Entity": {
      "Type": "Datastore",
      "Value": "datastore-34"
    },
    "LastModifiedTime": "2021-04-12T09:49:13.835363Z",
    "LastModifiedUser": "VSPHERE.LOCAL\\Administrator",
    "CreationEventId": 0
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment