Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I run the cron.RDS.sh script , zabbixCloudWatch.py did not get these variable values ($ZABBIX_SERVER , $ZABBIX_HOST,.......) #26

Open
wangyu8460958 opened this issue Dec 23, 2017 · 2 comments

Comments

@wangyu8460958
Copy link

wangyu8460958 commented Dec 23, 2017

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,.......)

@omni-lchen
Copy link
Owner

omni-lchen commented Jan 9, 2018

ZABBIX_HOST=$2
The value of ZABBIX_HOST "54.212.211.137" doesn't seem to be right, it should be the host name you set up in zabbix.

@wangyu8460958
Copy link
Author

Thanks very much. It's OK now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants