サーバーを監視してアラートメールを出したい
→muninでメール設定があるのは知っているので調べる
http://munin-monitoring.org/wiki/HowToContact
を見て、適当に
色々設定するが、
そもそもメールを今の状態でraspberry piから送れるんだろうか、
と思って調べていて
sendmailかなと思って、
sudo apt-get install sendmail
は失敗。
調べると、exim4というのがいいらしいので
sudo apt-get install exim4
これもエラーになる。
で、そもそも入っているのでconfigureするだけでいいんだよ的なことが
http://www.raspberrypi.org/forums/viewtopic.php?t=27937&p=288233
書かれているので、
sudo dpkg-reconfigure
http://www.sbprojects.com/projects/raspberrypi/exim4.php
もう1個ssmtpというのがあるというのでそちらを設定。
vi /etc/ssmptp/ssmtp.conf
で自分のgmailのアカウントを設定。
原因は、
自分で作った/etc/init.dの中にnode用に作った
ファイルのヘッダがおかしかったこと。
それを解決したらテストメールは送れるようになった。
echo "sample text" | mail -s "Subject" hogehoge@gmail.com
だが、今度はcronで今までシステムに送るはずだったメールが送信されるように。
http://www.raspberrypi.org/forums/viewtopic.php?t=43836&p=449137
このコード引用のごとく、
postmaster@raspberrypiにメールを送信して失敗したかのようなエラーメッセージ。
/etc/hostname を見ると
raspberrypi
と書いてあるのでこれはraspberrypiなはず。
で、このメール2種類あって、
1.
Mail Submission Program <fromのメールアドレス>
mkdir: cannot create directory `/var/run/sendmail': Permission denied
2.
Mail Delivery Subsystem <mailer-daemon@googlemail.com>
Delivery to the following recipient failed permanently:
postmaster@raspberrypi
Technical details of permanent failure:
DNS Error: Domain name not found
しょうがないから、
http://www.linuxquestions.org/questions/linux-newbie-8/cron-deamon-problem-4175424606/
この方法で、
*/20 * * * * smmsp test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp
の行をコメントアウト。
失敗したっていうメールではなくなったけど、
結局バッチ実行ごとにメールが送られて来る…
けどとりあえずmuninルールは作って
湿度が60%超えたらメールが送られるという要件は果たしました。
次は超えたときに外からリモコンでエアコンでドライをかける、に挑戦したいと思います。
→muninでメール設定があるのは知っているので調べる
http://munin-monitoring.org/wiki/HowToContact
を見て、適当に
色々設定するが、
そもそもメールを今の状態でraspberry piから送れるんだろうか、
と思って調べていて
sendmailかなと思って、
sudo apt-get install sendmail
は失敗。
調べると、exim4というのがいいらしいので
sudo apt-get install exim4
これもエラーになる。
で、そもそも入っているのでconfigureするだけでいいんだよ的なことが
http://www.raspberrypi.org/forums/viewtopic.php?t=27937&p=288233
書かれているので、
sudo dpkg-reconfigure
http://www.sbprojects.com/projects/raspberrypi/exim4.php
もう1個ssmtpというのがあるというのでそちらを設定。
vi /etc/ssmptp/ssmtp.conf
で自分のgmailのアカウントを設定。
原因は、
自分で作った/etc/init.dの中にnode用に作った
ファイルのヘッダがおかしかったこと。
それを解決したらテストメールは送れるようになった。
echo "sample text" | mail -s "Subject" hogehoge@gmail.com
だが、今度はcronで今までシステムに送るはずだったメールが送信されるように。
http://www.raspberrypi.org/forums/viewtopic.php?t=43836&p=449137
このコード引用のごとく、
postmaster@raspberrypiにメールを送信して失敗したかのようなエラーメッセージ。
/etc/hostname を見ると
raspberrypi
と書いてあるのでこれはraspberrypiなはず。
で、このメール2種類あって、
1.
Mail Submission Program <fromのメールアドレス>
mkdir: cannot create directory `/var/run/sendmail': Permission denied
2.
Mail Delivery Subsystem <mailer-daemon@googlemail.com>
Delivery to the following recipient failed permanently:
postmaster@raspberrypi
Technical details of permanent failure:
DNS Error: Domain name not found
しょうがないから、
http://www.linuxquestions.org/questions/linux-newbie-8/cron-deamon-problem-4175424606/
この方法で、
*/20 * * * * smmsp test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp
の行をコメントアウト。
失敗したっていうメールではなくなったけど、
結局バッチ実行ごとにメールが送られて来る…
けどとりあえずmuninルールは作って
湿度が60%超えたらメールが送られるという要件は果たしました。
次は超えたときに外からリモコンでエアコンでドライをかける、に挑戦したいと思います。
コメント
コメントを投稿