embano1 / vsphere-alarm-server

Kubernetes application which enriches vSphere Alarm Events with AlarmInfo details
Apache License 2.0
8 stars 1 forks source link

Logs aren't being enriched #41

Open DanPhonovation opened 1 year ago

DanPhonovation commented 1 year ago

I created a custom datastore alarm and can see the dispatcher sending an event, but it is not enriched as per the docs. Does this still work?

embano1 commented 1 year ago

I haven't used it since I left VMware. Is there any error message you see or logs in the enricher deployment?

rguske commented 1 year ago

@DanPhonovation I can validate its functionality tomorrow in my environment. Could you please provide me the versions you are running for vSphere (vCenter) and VEBA?

rguske commented 1 year ago

@DanPhonovation The vsphere-alarm-server works flawlessly in my env. I've followed the given example and created a datastore usage alarm which throws an error when the capacity is above 5%. Results are:

Logs vsphere-alarm-server:

{"level":"info","ts":1695368991.2118585,"logger":"vsphere-alarm-server","caller":"vsphere-alarm-server/server.go:138","msg":"got alarm event","commit":"3c4da8a3","tag":"v0.4.0","source":"https://vcsa.cpod-nsxv8.az-stc.cloud-garage.net/sdk","type":"com.vmware.vsphere.AlarmStatusChangedEvent.v0","moref":"Alarm:alarm-1303"}
{"level":"info","ts":1695368994.6933293,"logger":"vsphere-alarm-server","caller":"vsphere-alarm-server/server.go:138","msg":"got alarm event","commit":"3c4da8a3","tag":"v0.4.0","source":"https://vcsa.cpod-nsxv8.az-stc.cloud-garage.net/sdk","type":"com.vmware.event.router/event","moref":"Alarm:alarm-1303"}

Event displayed in Sockeye (veba-hostname/events):

Context Attributes,                                                                                                                                                                                                                                                                  │
│   specversion: 1.0                                                                                                                                                                                                                                                                   │
│   type: com.vmware.event.router/event.AlarmInfo                                                                                                                                                                                                                                      │
│   source: https://vcsa.cpod-nsxv8.az-stc.cloud-garage.net/sdk                                                                                                                                                                                                                        │
│   subject: AlarmReconfiguredEvent                                                                                                                                                                                                                                                    │
│   id: d365203f-b57e-4001-a399-3791b2b04a58                                                                                                                                                                                                                                           │
│   time: 2023-09-22T07:49:46.714866663Z                                                                                                                                                                                                                                               │
│   datacontenttype: application/json                                                                                                                                                                                                                                                  │
│ Data,                                                                                                                                                                                                                                                                                │
│   {                                                                                                                                                                                                                                                                                  │
│     "Key": 12402691,                                                                                                                                                                                                                                                                 │
│     "ChainId": 12402690,                                                                                                                                                                                                                                                             │
│     "CreatedTime": "2023-09-22T07:49:46.076999Z",                                                                                                                                                                                                                                    │
│     "UserName": "CPOD-NSXV8.AZ-STC.CLOUD-GARAGE.NET\\Administrator",                                                                                                                                                                                                                 │
│     "Datacenter": {                                                                                                                                                                                                                                                                  │
│       "Name": "cPod-NSXV8",                                                                                                                                                                                                                                                          │
│       "Datacenter": {                                                                                                                                                                                                                                                                │
│         "Type": "Datacenter",                                                                                                                                                                                                                                                        │
│         "Value": "datacenter-3"                                                                                                                                                                                                                                                      │
│       }                                                                                                                                                                                                                                                                              │
│     },                                                                                                                                                                                                                                                                               │
│     "ComputeResource": null,                                                                                                                                                                                                                                                         │
│     "Host": null,                                                                                                                                                                                                                                                                    │
│     "Vm": null,                                                                                                                                                                                                                                                                      │
│     "Ds": {                                                                                                                                                                                                                                                                          │
│       "Name": "vsanDatastore",                                                                                                                                                                                                                                                       │
│       "Datastore": {                                                                                                                                                                                                                                                                 │
│         "Type": "Datastore",                                                                                                                                                                                                                                                         │
│         "Value": "datastore-31"                                                                                                                                                                                                                                                      │
│       }                                                                                                                                                                                                                                                                              │
│     },                                                                                                                                                                                                                                                                               │
│     "Net": null,                                                                                                                                                                                                                                                                     │
│     "Dvs": null,                                                                                                                                                                                                                                                                     │
│     "FullFormattedMessage": "Reconfigured alarm 'kn-alarm-server-ds-full' on vsanDatastore.  \n \nModified:  \n \ninfo.enabled: false -\u003e true; \n\ninfo.lastModifiedTime: \"2023-09-22T07:48:58.151174Z\" -\u003e \"2023-09-22T07:49:46.070287Z\"; \n\n Added:  \n \n Deleted:  │
│     "ChangeTag": "",                                                                                                                                                                                                                                                                 │
│     "Alarm": {                                                                                                                                                                                                                                                                       │
│       "Name": "kn-alarm-server-ds-full",                                                                                                                                                                                                                                             │
│       "Alarm": {                                                                                                                                                                                                                                                                     │
│         "Type": "Alarm",                                                                                                                                                                                                                                                             │
│         "Value": "alarm-1303"                                                                                                                                                                                                                                                        │
│       }                                                                                                                                                                                                                                                                              │
│     },                                                                                                                                                                                                                                                                               │
│     "Entity": {                                                                                                                                                                                                                                                                      │
│       "Name": "vsanDatastore",                                                                                                                                                                                                                                                       │
│       "Entity": {                                                                                                                                                                                                                                                                    │
│         "Type": "Datastore",                                                                                                                                                                                                                                                         │
│         "Value": "datastore-31"                                                                                                                                                                                                                                                      │
│       }                                                                                                                                                                                                                                                                              │
│     },                                                                                                                                                                                                                                                                               │
│     "ConfigChanges": {                                                                                                                                                                                                                                                               │
│       "Modified": "info.enabled: false -\u003e true; \n\ninfo.lastModifiedTime: \"2023-09-22T07:48:58.151174Z\" -\u003e \"2023-09-22T07:49:46.070287Z\"; \n\n",                                                                                                                      │
│       "Added": "",                                                                                                                                                                                                                                                                   │
│       "Deleted": ""                                                                                                                                                                                                                                                                  │
│     },                                                                                                                                                                                                                                                                               │
│     "AlarmInfo": {                                                                                                                                                                                                                                                                   │
│       "Name": "kn-alarm-server-ds-full",                                                                                                                                                                                                                                             │
│       "SystemName": "",                                                                                                                                                                                                                                                              │
│       "Description": "",                                                                                                                                                                                                                                                             │
│       "Enabled": true,                                                                                                                                                                                                                                                               │
│       "Expression": {     
│         "Expression": [                                                                                                                                                                                                                                                              │
│           {                                                                                                                                                                                                                                                                          │
│             "Operator": "isAbove",                                                                                                                                                                                                                                                   │
│             "Type": "Datastore",                                                                                                                                                                                                                                                     │
│             "Metric": {                                                                                                                                                                                                                                                              │
│               "CounterId": 278,                                                                                                                                                                                                                                                      │
│               "Instance": ""                                                                                                                                                                                                                                                         │
│             },                                                                                                                                                                                                                                                                       │
│             "Yellow": 0,                                                                                                                                                                                                                                                             │
│             "YellowInterval": 0,                                                                                                                                                                                                                                                     │
│             "Red": 500,                                                                                                                                                                                                                                                              │
│             "RedInterval": 0                                                                                                                                                                                                                                                         │
│           }                                                                                                                                                                                                                                                                          │
│         ]                                                                                                                                                                                                                                                                            │
│       },                                                                                                                                                                                                                                                                             │
│       "Action": null,                                                                                                                                                                                                                                                                │
│       "ActionFrequency": 0,                                                                                                                                                                                                                                                          │
│       "Setting": {                                                                                                                                                                                                                                                                   │
│         "ToleranceRange": 0,                                                                                                                                                                                                                                                         │
│         "ReportingFrequency": 300                                                                                                                                                                                                                                                    │
│       },                                                                                                                                                                                                                                                                             │
│       "Key": "",                                                                                                                                                                                                                                                                     │
│       "Alarm": {                                                                                                                                                                                                                                                                     │
│         "Type": "Alarm",                                                                                                                                                                                                                                                             │
│         "Value": "alarm-1303"                                                                                                                                                                                                                                                        │
│       },                                                                                                                                                                                                                                                                             │
│       "Entity": {                                                                                                                                                                                                                                                                    │
│         "Type": "Datastore",                                                                                                                                                                                                                                                         │
│         "Value": "datastore-31"                                                                                                                                                                                                                                                      │
│       },                                                                                                                                                                                                                                                                             │
│       "LastModifiedTime": "2023-09-22T07:49:46.070287Z",                                                                                                                                                                                                                             │
│       "LastModifiedUser": "CPOD-NSXV8.AZ-STC.CLOUD-GARAGE.NET\\Administrator",                                                                                                                                                                                                       │
│       "CreationEventId": 0                                                                                                                                                                                                                                                           │
│     }                                                                                                                                                                                                                                                                                │
│   }                                                                                        

Could it be a permissions issue in your case?

Unfortunately, I noticed that we have another issue with all other function examples since we can't pull images from ghrc anymore after the recent migration from gcr. See #1104