Hi,
I am trying to monitor a couple of instances that I have running on Amazon AWS and to do that, I am trying to use the Zabbix-Cloudwatch.
The script was obviously not written for FreeBSD so I have adapted a bit of the code. The bit I am stuck in is below:
/usr/local/etc/zabbix34/cloudwatch/cron.d/cron.RDS.sh
Could anyone please help me sorting the date issue?
Also, I will welcome any alternative script people or willing to share
I am trying to monitor a couple of instances that I have running on Amazon AWS and to do that, I am trying to use the Zabbix-Cloudwatch.
The script was obviously not written for FreeBSD so I have adapted a bit of the code. The bit I am stuck in is below:
/usr/local/etc/zabbix34/cloudwatch/cron.d/cron.RDS.sh
Code:
#!/usr/local/bin/bash
# Date: 08/08/2015
# Author: Long Chen
# Description: A script to bulk send RDS cloudwatch data to zabbix server
PATH=$PATH:/usr/local/etc/zabbix34/cloudwatch
export PATH
# DB instance indentifier
DB_INSTANCE=$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
# Adding lag, as CloudWatch doesn't send all data if requested too early.
ENDTIME=$(date -u "+%F %H:%M:00" -d "5 minutes ago")
STARTTIME=$(date -u "+%F %H:%M:00" -d "10 minutes ago")
# Send cloudwatch data of a table to Zabbix Server
zabbixCloudWatch.py -z "$ZABBIX_SERVER" -x "$ZABBIX_HOST" -a "$ACCOUNT" -r "$REGION" -s "RDS" -d "DBInstanceIdentifier=$DB_INSTANCE" -p "$PERIOD" -f "$STARTTIME" -t "$ENDTIME"
./cron.RDS.sh
Code:
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
env: python: No such file or directory
Also, I will welcome any alternative script people or willing to share