Zabbix 2.0.9
CentOS 6.4 Final 64bit
I created a MediaType: script (aws_sms.sh)
I realized that zabbix user passwd is /sbin/nologin updated to /bin/bash
the home directory did not get created during install; I created one, manually added .bashrc.
restarted zabbix-server.
during an alert the command in the script that is referring to AWS cli tools is not found?
I can login as zabbix user and run command but then none of my .bashrc env. variables are picked up, which I think i may need .bash_profile? will test next.. But that wont solve the real problem when zabbix-server runs command i get aws command not found.
Also tried doing some stuff in visudo
Cmnd_Alias AWS = /usr/lib/aws/
%zabbix ALL=AWS NOPASSWD=ALL
Which gave me errors every time i tried to save.
also tried
%zabbix ALL=(ALL) ALL
Maybe I should not refer to the zabbix group and just user?
I was trying to keep it simple?
Any hints or experience in allowing zabbix user to run bash scripts referring to shell commands would be appreciated!
Thank you for your diligence.
EDIT:
I have updated the script with:
#!/bin/sh
/usr/lib/bin/aws
The command is found!
HOW do I give or get Environment variables for user zabbix?
I created a .bashrc and .bash_profile with the correct data, but shell still returns please define AWS_DEFAULT_REGION
i can set this in the command line, but after i fix this error it will ask for credentials, which i have created a path to for Env variable AWS_Credentials?
Your insight is appreciated!
CentOS 6.4 Final 64bit
I created a MediaType: script (aws_sms.sh)
I realized that zabbix user passwd is /sbin/nologin updated to /bin/bash
the home directory did not get created during install; I created one, manually added .bashrc.
restarted zabbix-server.
during an alert the command in the script that is referring to AWS cli tools is not found?
Code:
#!/bin/bash to=$1 subject=$2 body=$3 aws sns publish --topic-arn "<mytopicarn>" --message "$subject**$body"
Also tried doing some stuff in visudo
Cmnd_Alias AWS = /usr/lib/aws/
%zabbix ALL=AWS NOPASSWD=ALL
Which gave me errors every time i tried to save.
also tried
%zabbix ALL=(ALL) ALL
Maybe I should not refer to the zabbix group and just user?
I was trying to keep it simple?
Any hints or experience in allowing zabbix user to run bash scripts referring to shell commands would be appreciated!
Thank you for your diligence.
EDIT:
I have updated the script with:
#!/bin/sh
/usr/lib/bin/aws
The command is found!
HOW do I give or get Environment variables for user zabbix?
I created a .bashrc and .bash_profile with the correct data, but shell still returns please define AWS_DEFAULT_REGION
i can set this in the command line, but after i fix this error it will ask for credentials, which i have created a path to for Env variable AWS_Credentials?
Your insight is appreciated!
Comment