How to let the admin get noticed when 500 errors occurred in nginx?
Asked
Active
Viewed 4,049 times
2
-
Just for some attempted clarification. Do you want to setup an alert to the admin (you, presumably) if the number of errors on your webserver reaches a certain threshold, in this case 500? – LukeR Jan 21 '10 at 05:21
-
Yes, that's what I mean. – Cheng Jan 21 '10 at 09:59
-
I use a commercial service at http://www.wormly.com – Vasili Syrakis May 22 '14 at 05:20
3 Answers
4
Most monitoring systems, whether they're software you install like Nagios or Zabbix or monitoring services such as Panopta or Pingdom, can be configured to detect 500 responses as errors and alert you to investigate. The benefit of using a full monitoring system is that you can get SMS or voice alerts in addition to just emails. You can also get notified if the server itself goes down or loses all connectivity, which a local cron script wouldn't be able to handle.

Jason Abate
- 441
- 4
- 3
-
Yes but Pingdom cannot tell you when there's a 500 error occurring during signups from a particular country while a local script can. – Chibueze Opata Sep 11 '22 at 20:33
2
maybe you could do something with a bash script, like
#!/bin/bash
b=`grep 'error' -c /var/log/nginx.log`
if [[ $b -gt 500 ]] ; then
echo "more than 500 errors";
# or send an email
else
#echo "OK" > /dev/null 2>&1
fi

Razique
- 2,276
- 1
- 19
- 23
-
-
1`[[` does not support comparison using `>`; you need either `-gt`/`-lt` or `(( ))`. See http://mywiki.wooledge.org/BashPitfalls#A.5B.5B_.24foo_.3E_7_.5D.5D – user1686 Jan 22 '10 at 14:26
-
0
No matter you use scripts or monitoring systems. You can used "curl" to check the http status code.

user164485
- 51
- 1
- 6