github.com/vmware/govmomi@v0.51.0/simulator/vpx/alarm_manager.go (about)

     1  // © Broadcom. All Rights Reserved.
     2  // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package vpx
     6  
     7  import (
     8  	"time"
     9  
    10  	"github.com/vmware/govmomi/vim25/mo"
    11  	"github.com/vmware/govmomi/vim25/types"
    12  )
    13  
    14  // Alarm captured using:
    15  // govc alarm.info -dump -n alarm.VmErrorAlarm -n alarm.HostErrorAlarm
    16  var Alarm = []mo.Alarm{
    17  	{
    18  		ExtensibleManagedObject: mo.ExtensibleManagedObject{
    19  			Self:           types.ManagedObjectReference{Type: "Alarm", Value: "alarm-384", ServerGUID: ""},
    20  			Value:          nil,
    21  			AvailableField: nil,
    22  		},
    23  		Info: types.AlarmInfo{
    24  			AlarmSpec: types.AlarmSpec{
    25  				Name:        "vcsim VM Alarm",
    26  				SystemName:  "",
    27  				Description: "vcsim alarm for Virtual Machines",
    28  				Enabled:     true,
    29  				Expression: &types.OrAlarmExpression{
    30  					AlarmExpression: types.AlarmExpression{},
    31  					Expression: []types.BaseAlarmExpression{
    32  						&types.EventAlarmExpression{
    33  							AlarmExpression: types.AlarmExpression{},
    34  							Comparisons:     nil,
    35  							EventType:       "EventEx",
    36  							EventTypeId:     "vcsim.vm.success",
    37  							ObjectType:      "VirtualMachine",
    38  							Status:          "green",
    39  						},
    40  						&types.EventAlarmExpression{
    41  							AlarmExpression: types.AlarmExpression{},
    42  							Comparisons:     nil,
    43  							EventType:       "EventEx",
    44  							EventTypeId:     "vcsim.vm.failure",
    45  							ObjectType:      "VirtualMachine",
    46  							Status:          "yellow",
    47  						},
    48  						&types.EventAlarmExpression{
    49  							AlarmExpression: types.AlarmExpression{},
    50  							Comparisons:     nil,
    51  							EventType:       "EventEx",
    52  							EventTypeId:     "vcsim.vm.fatal",
    53  							ObjectType:      "VirtualMachine",
    54  							Status:          "red",
    55  						},
    56  					},
    57  				},
    58  				Action:          nil,
    59  				ActionFrequency: 0,
    60  				Setting: &types.AlarmSetting{
    61  					ToleranceRange:     0,
    62  					ReportingFrequency: 300,
    63  				},
    64  			},
    65  			Key:              "",
    66  			Alarm:            types.ManagedObjectReference{Type: "Alarm", Value: "alarm-384", ServerGUID: ""},
    67  			Entity:           types.ManagedObjectReference{Type: "Folder", Value: "group-d1", ServerGUID: ""},
    68  			LastModifiedTime: time.Now(),
    69  			LastModifiedUser: "VSPHERE.LOCAL\\Administrator",
    70  			CreationEventId:  0,
    71  		},
    72  	},
    73  	{
    74  		ExtensibleManagedObject: mo.ExtensibleManagedObject{
    75  			Self:           types.ManagedObjectReference{Type: "Alarm", Value: "alarm-11", ServerGUID: ""},
    76  			Value:          nil,
    77  			AvailableField: nil,
    78  		},
    79  		Info: types.AlarmInfo{
    80  			AlarmSpec: types.AlarmSpec{
    81  				Name:        "Host error",
    82  				SystemName:  "alarm.HostErrorAlarm",
    83  				Description: "Default alarm to monitor host error and warning events",
    84  				Enabled:     true,
    85  				Expression: &types.OrAlarmExpression{
    86  					AlarmExpression: types.AlarmExpression{},
    87  					Expression: []types.BaseAlarmExpression{
    88  						&types.EventAlarmExpression{
    89  							AlarmExpression: types.AlarmExpression{},
    90  							Comparisons:     nil,
    91  							EventType:       "GeneralHostErrorEvent",
    92  							EventTypeId:     "",
    93  							ObjectType:      "HostSystem",
    94  							Status:          "",
    95  						},
    96  						&types.EventAlarmExpression{
    97  							AlarmExpression: types.AlarmExpression{},
    98  							Comparisons:     nil,
    99  							EventType:       "GeneralHostWarningEvent",
   100  							EventTypeId:     "",
   101  							ObjectType:      "HostSystem",
   102  							Status:          "",
   103  						},
   104  					},
   105  				},
   106  				Action: &types.GroupAlarmAction{
   107  					AlarmAction: types.AlarmAction{},
   108  					Action: []types.BaseAlarmAction{
   109  						&types.AlarmTriggeringAction{
   110  							AlarmAction: types.AlarmAction{},
   111  							Action:      &types.SendSNMPAction{},
   112  							TransitionSpecs: []types.AlarmTriggeringActionTransitionSpec{
   113  								{
   114  									StartState: "yellow",
   115  									FinalState: "red",
   116  									Repeats:    true,
   117  								},
   118  							},
   119  							Green2yellow: false,
   120  							Yellow2red:   false,
   121  							Red2yellow:   false,
   122  							Yellow2green: false,
   123  						},
   124  					},
   125  				},
   126  				ActionFrequency: 0,
   127  				Setting: &types.AlarmSetting{
   128  					ToleranceRange:     0,
   129  					ReportingFrequency: 300,
   130  				},
   131  			},
   132  			Key:              "",
   133  			Alarm:            types.ManagedObjectReference{Type: "Alarm", Value: "alarm-11", ServerGUID: ""},
   134  			Entity:           types.ManagedObjectReference{Type: "Folder", Value: "group-d1", ServerGUID: ""},
   135  			LastModifiedTime: time.Now(),
   136  			LastModifiedUser: "",
   137  			CreationEventId:  0,
   138  		},
   139  	},
   140  	{
   141  		ExtensibleManagedObject: mo.ExtensibleManagedObject{
   142  			Self:           types.ManagedObjectReference{Type: "Alarm", Value: "alarm-12", ServerGUID: ""},
   143  			Value:          nil,
   144  			AvailableField: nil,
   145  		},
   146  		Info: types.AlarmInfo{
   147  			AlarmSpec: types.AlarmSpec{
   148  				Name:        "Virtual machine error",
   149  				SystemName:  "alarm.VmErrorAlarm",
   150  				Description: "Default alarm to monitor virtual machine error and warning events",
   151  				Enabled:     true,
   152  				Expression: &types.OrAlarmExpression{
   153  					AlarmExpression: types.AlarmExpression{},
   154  					Expression: []types.BaseAlarmExpression{
   155  						&types.EventAlarmExpression{
   156  							AlarmExpression: types.AlarmExpression{},
   157  							Comparisons:     nil,
   158  							EventType:       "GeneralVmErrorEvent",
   159  							EventTypeId:     "",
   160  							ObjectType:      "VirtualMachine",
   161  							Status:          "",
   162  						},
   163  						&types.EventAlarmExpression{
   164  							AlarmExpression: types.AlarmExpression{},
   165  							Comparisons:     nil,
   166  							EventType:       "GeneralVmWarningEvent",
   167  							EventTypeId:     "",
   168  							ObjectType:      "VirtualMachine",
   169  							Status:          "",
   170  						},
   171  					},
   172  				},
   173  				Action: &types.GroupAlarmAction{
   174  					AlarmAction: types.AlarmAction{},
   175  					Action: []types.BaseAlarmAction{
   176  						&types.AlarmTriggeringAction{
   177  							AlarmAction: types.AlarmAction{},
   178  							Action:      &types.SendSNMPAction{},
   179  							TransitionSpecs: []types.AlarmTriggeringActionTransitionSpec{
   180  								{
   181  									StartState: "yellow",
   182  									FinalState: "red",
   183  									Repeats:    true,
   184  								},
   185  							},
   186  							Green2yellow: false,
   187  							Yellow2red:   false,
   188  							Red2yellow:   false,
   189  							Yellow2green: false,
   190  						},
   191  					},
   192  				},
   193  				ActionFrequency: 0,
   194  				Setting: &types.AlarmSetting{
   195  					ToleranceRange:     0,
   196  					ReportingFrequency: 300,
   197  				},
   198  			},
   199  			Key:              "",
   200  			Alarm:            types.ManagedObjectReference{Type: "Alarm", Value: "alarm-12", ServerGUID: ""},
   201  			Entity:           types.ManagedObjectReference{Type: "Folder", Value: "group-d1", ServerGUID: ""},
   202  			LastModifiedTime: time.Now(),
   203  			LastModifiedUser: "",
   204  			CreationEventId:  0,
   205  		},
   206  	},
   207  }