Reputation: 91
I have a website running and today I checked it to find out that the server is returning 502 error. I would rather want to know as soon as possible when it happens again to fix it, so I was thinking about some kind of a solution which will notify me (email) when the server is returning 500 or 502 error. I know that there are some kind of monitoring apps like zabbix or nagios but I think that It would be an overkill because I don't really need that many functions they provide. Is there an easier way to set up those notifications that you would reccomend?
Upvotes: 1
Views: 1066
Reputation: 5951
Write a php script that creates an email notification.
Create a custom error page for 500/502 errors and insert your notification script into the code which generates the page.
Use the error_page
directive to have Nginx serve this page to clients on error instead of the standard 500/502 error page. Disable caching for this page. Now every time a client is served this error page your script will run.
Upvotes: 2