11.6.3 Execute the command. (AWS CloudWatch linkage tool)
- Organization of this subsection
(1) Run manually (for Windows)
The following shows how to run AWS CloudWatch linkage tool manually in a Windows environment.
-
Log in to the server running AWS CloudWatch linkage.
-
Start Command Prompt.
-
Navigate to the "sendevent_aws" copied in "11.6.2(2)(a) Layout of AWS CloudWatch linkage".
C:\XXX> cd ...\sendevent_aws
-
Execute "sendevent_aws.py" in Python of "11.6.1 Prerequisites (AWS CloudWatch linkage)".
-
To execute the alarm after the previous execution
C:\XXX> python sendevent_aws.py
-
When executing an alarm after Current date and time
C:\XXX> python sendevent_aws.py -now
-
-
Confirm the outcome of executing "sendevent_aws.py".
C:\XXX> echo %ERRORLEVEL% 0#
#: "0" means normal termination, except "0" means abnormal termination.
(2) Run manually (for Linux)
The following shows how to run AWS CloudWatch linkage tool manually in a Linux environment.
-
Log in to the server running AWS CloudWatch linkage.
-
Navigate to the "sendevent_aws" copied in "11.6.2(2)(a) Layout of AWS CloudWatch linkage".
$ cd .../sendevent_aws
-
Execute "sendevent_aws.py" in Python of "11.6.1 Prerequisites (AWS CloudWatch linkage)".
-
To execute the alarm after the previous execution
$ python sendevent.py
-
When executing an alarm after Current date and time
$ python sendevent.py -now
-
-
Confirm the outcome of executing "sendevent_aws.py".
$ echo $? 0#
#: "0" means normal termination, except "0" means abnormal termination.
(3) Regular run (for Windows)
The following is an example of regularly executing AWS CloudWatch linkage in a Windows environment.
-
Start the task scheduler and configure it to run sendevent_aws.py regularly.
-
Click Create Basic Task.
-
Under Operation, select Start Program and set the following values:
-
Program/Script: Specify the "python.exe" in Python of "11.6.1 Prerequisites (AWS CloudWatch linkage)".
-
Add Argument (Optional): Specify sendevent_aws.py.
-
Start (optional): Specify the "sendevent_aws" that was copied in " 11.6.2(2)(a) Layout of AWS CloudWatch linkage".
-
(4) Regular run (for Linux)
The following is an example of regularly executing AWS CloudWatch linkage in a Linux environment.
-
Log in to AWS CloudWatch linkage tool execution server.
-
Opens CRON settings window.
$ crontab -e
-
Configure and save CRON settings.
Here, as an example, it is set to run every 5 minutes.
*/5 * * * * #1/usr/bin/python#2 .../sendevent_aws/sendevent_aws.py#3
- #1
-
Specifies that CRON is scheduled to run.
- #2
-
Specify python in Python of " 11.6.1 Prerequisites (AWS CloudWatch linkage) ".
- #3
-
Specify the path of "sendevent_aws.py" under "sendevent_aws" copied in "11.6.2(2)(a) Layout of AWS CloudWatch linkage".