Comments (4)
How are you setting the SMTP Relay?
from docker-nagios.
I made my own Dockerfile to install a few other packages and a script as my ENTRYPOINT, the script does a sed to replace the relayhost and then starts nagios.
Dockerfile
FROM jasonrivers/nagios:latest
COPY ./dep/container-startup.sh /usr/bin/
RUN apt-get update; \
apt-get install vim -y; \
apt-get install telnet -y; \
chmod 777 /usr/bin/container-startup.sh;
# Set the entry point for the docker image.
ENTRYPOINT ["/usr/bin/container-startup.sh"]
container-startup.sh
#!/bin/sh
# need to /etc/postfix/main.cf to add our SMTP server as relay host
echo "STARTUP Adjusting SMTP_HOST..."
#Send to the log what we passed in the env
echo "SMTP_HOST=${SMTP_HOST}" >> /tmp/container-startup.log
#replace relayhost with our host
sed -i "s/relayhost =/relayhost =${SMTP_HOST}/g" /etc/postfix/main.cf
#echo to Docker log and write to our log to prove we have done the replace
cat /etc/postfix/main.cf | grep relayhost
cat /etc/postfix/main.cf | grep relayhost >> /tmp/container-startup.log
# We set the relay host in main.cf and then once we start nagios it gets blown away, and reset to empty
echo "STARTUP Starting nagios..."
/usr/local/bin/start_nagios
Results from within Containter
My log shows that I changed it, but when I go and look it is back to relayhost=
# cat /tmp/container-startup.log
SMTP_HOST=12.14.25.151
relayhost =12.14.25.151
#
# cat /etc/postfix/main.cf | grep relayhost
relayhost =
#
And that bonus question I talked about...how is this picking up my corporate email server? I know WHY it is bouncing and I can fix that by just giving a valid corporate email from address. What I don't get is where the nagios container is getting THAT IP & SMTP host from...I didn't set it anywhere. The servers and IPs in the log below have been obfuscated.
Docker Log
postfix/smtp[8964]: 21F2C1805507: to=<[email protected]>, relay=mycompany-mx01.com[12.22.8.37]:25, delay=0.29, delays=0.15/0/0.07/0.06, dsn=7.1.2, status=bounced (host mycompany-mx01.com[12.22.8.37] said: 504 7.1.2 <nagios@a123acfdf44d>: Sender address rejected: need fully-qualified address (in reply to RCPT TO command))
from docker-nagios.
Alternatively you can have a simple script that executes:
postconf -e "relayhost=YOURSMTPRELAY"
postfix reload
whenever your container is started....
from docker-nagios.
The problem here is that you're still calling /usr/local/bin/start_nagios which I assume you have not modified, this script then starts runsvdir on /erc/service - which I again assume you did not change any of the contents of.
In the postfix/run script there is this line:
sed -i "s/relayhost =.*/relayhost = ${MAIL_RELAY_HOST}/" /etc/postfix/main.cf
which is what is replacing it before postfix has started. This could be better by checking MAIL_RELAY_HOST first, and also using postconf, but you'll need to edit this script too. Alternatively, just use: -e MAIL_RELAY_HOST=mail.example.com
when you start the container.
from docker-nagios.
Related Issues (20)
- Install aditional PHP modules / software HOT 1
- Perl Encryption Libraries Not Present HOT 3
- NSCA Port 5667 Mapping HOT 5
- Include rsync HOT 4
- Update to Nagios Core 4.4.7 HOT 3
- ssh connection? gns3 HOT 2
- Error: Failed to create IO broker set: Cannot allocate memory HOT 6
- Nagios script request : check_apc.pl HOT 1
- Apache2 and NSCA not removing PID on reboot HOT 4
- Unable to get process status HOT 5
- Segmentation fault (core dumped) running nagios HOT 8
- NRPE plugin not installed in the container? HOT 2
- ENVs are not populated using notify_by_xmpp
- Nagios service does not start HOT 1
- HTTPS Options? HOT 2
- wrong data from remote server
- No map shown when using Umlaut in alias HOT 2
- postfix username and password for AWS SES HOT 1
- Not using nsca fills up the docker log file
- Web UI doesnt showup any config data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-nagios.