script 'aws_discovery.py' is a dependency for the discovery key/script 'aws.discovery'.
By default, the python code should be located '/usr/lib/zabbix/scripts/aws_discovery.py'
Discovery key (another script) is located in '/usr/lib/zabbix/externalscripts/aws.discovery'. Must be also executable, owned by Linux user 'zabbix'.
Code of aws.discovery is fairly simple:
#!/bin/bash
ZABBIX_HOME=/usr/lib/zabbix/scripts
cd $ZABBIX_HOME
if [ $# -gt 3 ]
then
./aws_discovery.py --service $1 --region $2 --account $3 --args ${@:4}
else
./aws_discovery.py --service $1 --region $2 --account $3
fi
Let's test Zabbix external script from command line. Move to Zabbix default environment (which is 'sh'):su - zabbix -s /bin/sh
Enter external scripts directory:cd /usr/lib/zabbix/externalscripts
To simulate 'aws.discovery[ec2,\{$REGION},\{$ACCOUNT}]' discovery, it will require to use syntax:./aws.discovery 'ec2' '{$REGION}' '{$ACCOUNT}'
Replace {$REGION} and {$ACCOUNT}.
No comments:
Post a Comment