I create a cron.AWSInstance.sh script (This script is copy from cron.RDS.sh ).
The content of the cron.AWSInstance.sh script is :
!/bin/bash
PATH=$PATH:/opt/zabbix/cloudwatch
export PATH
EC2 instance indentifier
ID=$1
Zabbix Host
ZABBIX_HOST=$2
Zabbix Server
ZABBIX_SERVER=$3
AWS Account
ACCOUNT=$4
AWS Region
REGION=$5
Collecting 5-minute data from cloudwatch
PERIOD="300"
Set start time and end time for collecting cloudwatch data
ENDTIME=$(date -u "+%F %H:%M:00")
STARTTIME=$(date -u "+%F %H:%M:00" -d "5 minutes ago")
When I run the cron.AWSInstance.sh script like this :
./cron.AWSINSTANCE.sh "i-0d3138e5be40eft01" "54.212.211.137" "superman-zabbix.man-webplatform.com" "CloudWatch-test" "cn-north-1" &>/dev/null
The cloudwatch information of EC2 server can't transfer to Zabbix Server.
My question is :
Can these variables defined in the shell script (such as $ZABBIX_SERVER , $ENDTIME)transfer directly as a parameter to a python script like this :
zabbixCloudWatch.py -z "$ZABBIX_SERVER" -x "$ZABBIX_HOST" -a "$ACCOUNT" -r "$REGION" -s "EC2" -d "InstanceId=$ID" -p "$PERIOD" -f "$STARTTIME" -t "$ENDTIME"
I feel zabbixCloudWatch.py did not get these variable values ($ZABBIX_SERVER , $ZABBIX_HOST,.......)
When I direct run the script zabbixCloudWatch.py ,the cloudwatch information of EC2 server can transfer to Zabbix Server .
[root@redhat cloudwatch]# /usr/bin/python zabbixCloudWatch.py -x "54.212.211.137" -z "superman-zabbix.man-webplatform.com" -a "CloudWatch-test" -r "cn-north-1" -s "EC2" -d "InstanceId=i-0d3138e5be40eft01" -p "300" -f "2017-12-22 01:40:00" -t "2017-12-22 01:45:00"
I create a cron.AWSInstance.sh script (This script is copy from cron.RDS.sh ). The content of the cron.AWSInstance.sh script is :
!/bin/bash
PATH=$PATH:/opt/zabbix/cloudwatch export PATH
EC2 instance indentifier
ID=$1
Zabbix Host
ZABBIX_HOST=$2
Zabbix Server
ZABBIX_SERVER=$3
AWS Account
ACCOUNT=$4
AWS Region
REGION=$5
Collecting 5-minute data from cloudwatch
PERIOD="300" Set start time and end time for collecting cloudwatch data ENDTIME=$(date -u "+%F %H:%M:00") STARTTIME=$(date -u "+%F %H:%M:00" -d "5 minutes ago")
Sendcloudwatch data of a table to Zabbix Server
zabbixCloudWatch.py -z "$Zabbix Server" -x "$ZABBIX_HOST" -a "$ACCOUNT" -r "$REGION" -s "EC2" -d "InstanceId=$ID" -p "$PERIOD" -f "$STARTTIME" -t "$ENDTIME"
When I run the cron.AWSInstance.sh script like this : ./cron.AWSINSTANCE.sh "i-0d3138e5be40eft01" "54.212.211.137" "superman-zabbix.man-webplatform.com" "CloudWatch-test" "cn-north-1" &>/dev/null
The cloudwatch information of EC2 server can't transfer to Zabbix Server.
My question is : Can these variables defined in the shell script (such as $ZABBIX_SERVER , $ENDTIME)transfer directly as a parameter to a python script like this : zabbixCloudWatch.py -z "$ZABBIX_SERVER" -x "$ZABBIX_HOST" -a "$ACCOUNT" -r "$REGION" -s "EC2" -d "InstanceId=$ID" -p "$PERIOD" -f "$STARTTIME" -t "$ENDTIME"
I feel zabbixCloudWatch.py did not get these variable values ($ZABBIX_SERVER , $ZABBIX_HOST,.......)