com.vmware.vim25.mo.samples.alarm.CreateVmAlarm.class Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vijava Show documentation
Show all versions of vijava Show documentation
Java API for accessing VMWare web services API
The newest version!
???? 2 /com/vmware/vim25/mo/samples/alarm/CreateVmAlarm java/lang/Object ()V Code
LineNumberTable LocalVariableTable this 1Lcom/vmware/vim25/mo/samples/alarm/CreateVmAlarm; main ([Ljava/lang/String;)V
Exceptions java/lang/Exception java/lang/System out Ljava/io/PrintStream; >Usage: java CreateVmAlarm
java/io/PrintStream println (Ljava/lang/String;)V " #com/vmware/vim25/mo/ServiceInstance $ java/net/URL
# &
! ( ) 6(Ljava/net/URL;Ljava/lang/String;Ljava/lang/String;Z)V + &com/vmware/vim25/mo/InventoryNavigator
! - . /
getRootFolder ()Lcom/vmware/vim25/mo/Folder;
* 1 2 &(Lcom/vmware/vim25/mo/ManagedEntity;)V 4 VirtualMachine
* 6 7 8 searchManagedEntity I(Ljava/lang/String;Ljava/lang/String;)Lcom/vmware/vim25/mo/ManagedEntity; : "com/vmware/vim25/mo/VirtualMachine < java/lang/StringBuilder > Cannot find the VM
; &
; A B C append -(Ljava/lang/String;)Ljava/lang/StringBuilder; E
Existing...
; G H I toString ()Ljava/lang/String;
! K L M getServerConnection (()Lcom/vmware/vim25/mo/ServerConnection;
O Q P $com/vmware/vim25/mo/ServerConnection R logout
! T U V getAlarmManager $()Lcom/vmware/vim25/mo/AlarmManager; X com/vmware/vim25/AlarmSpec
W
[ \ ] createStateAlarmExpression )()Lcom/vmware/vim25/StateAlarmExpression;
_ ` a createEmailAction $()Lcom/vmware/vim25/SendEmailAction;
c d e createAlarmTriggerAction C(Lcom/vmware/vim25/Action;)Lcom/vmware/vim25/AlarmTriggeringAction;
g h i createPowerOnAction !()Lcom/vmware/vim25/MethodAction; k !com/vmware/vim25/GroupAlarmAction
j n com/vmware/vim25/AlarmAction
j p q r setAction "([Lcom/vmware/vim25/AlarmAction;)V
W t q u !(Lcom/vmware/vim25/AlarmAction;)V
W w x y
setExpression %(Lcom/vmware/vim25/AlarmExpression;)V { VmPowerStateAlarm
W } ~ setName ? @Monitor VM state and send email and power it on if VM powers off
W ? ? setDescription
W ? ? ?
setEnabled (Z)V ? com/vmware/vim25/AlarmSetting
?
? ? ? ? setReportingFrequency (I)V
? ? ? ? setToleranceRange
W ? ? ?
setSetting "(Lcom/vmware/vim25/AlarmSetting;)V
? ? ? com/vmware/vim25/mo/AlarmManager ? ? createAlarm \(Lcom/vmware/vim25/mo/ManagedEntity;Lcom/vmware/vim25/AlarmSpec;)Lcom/vmware/vim25/mo/Alarm; args [Ljava/lang/String; si %Lcom/vmware/vim25/mo/ServiceInstance; vmname Ljava/lang/String; inv (Lcom/vmware/vim25/mo/InventoryNavigator; vm $Lcom/vmware/vim25/mo/VirtualMachine; alarmMgr "Lcom/vmware/vim25/mo/AlarmManager; spec Lcom/vmware/vim25/AlarmSpec;
expression 'Lcom/vmware/vim25/StateAlarmExpression; emailAction Lcom/vmware/vim25/AlarmAction; methodAction gaa #Lcom/vmware/vim25/GroupAlarmAction; as Lcom/vmware/vim25/AlarmSetting;
StackMapTable ? ? java/lang/String ? %com/vmware/vim25/StateAlarmExpression
?
? ? ? setType ? runtime.powerState
? ? ? setStatePath ? ? ? #com/vmware/vim25/StateAlarmOperator ? ? isEqual %Lcom/vmware/vim25/StateAlarmOperator;
? ? ? ? setOperator ((Lcom/vmware/vim25/StateAlarmOperator;)V ?
poweredOff
? ? ? setRed ? com/vmware/vim25/MethodAction
? ? PowerOnVM_Task
? } ? %com/vmware/vim25/MethodActionArgument
?
? ? ? ? setValue (Ljava/lang/Object;)V
? ? ? ? setArgument +([Lcom/vmware/vim25/MethodActionArgument;)V action Lcom/vmware/vim25/MethodAction; argument 'Lcom/vmware/vim25/MethodActionArgument; ? com/vmware/vim25/SendEmailAction
? ? [email protected]
? ? ? setToList ? [email protected]
? ? ? setCcList ? $Alarm - {alarmName} on {targetName}
? ? ?
setSubject ? ?Description:{eventDescription}
TriggeringSummary:{triggeringSummary}
newStatus:{newStatus}
oldStatus:{oldStatus}
target:{target}
? ? ? setBody "Lcom/vmware/vim25/SendEmailAction; ? &com/vmware/vim25/AlarmTriggeringAction
?
? ?
setYellow2red
? q (Lcom/vmware/vim25/Action;)V Lcom/vmware/vim25/Action; alarmAction (Lcom/vmware/vim25/AlarmTriggeringAction;
SourceFile CreateVmAlarm.java ! / *? ?
7
S ?*?? ? ? ?? !Y? #Y*2? %*2*2? 'L*2M? *Y+? ,? 0N-3,? 5? 9:? &? ? ;Y=? ?,? @D? @? F? +? J? N?+? S:? WY? Y:? Z:? ^? b:? f? b: ? jY? l:
? mYSY S? o
? s? vz? |? ?? ?? ?Y? ?:? ?? ?? ?? ?W+? J? N?
? ) ; = ? B C $ B ( E , F 0 G 4 F 8 H 9 I <