2

How to let the admin get noticed when 500 errors occurred in nginx?

Cheng
  • 741
  • 2
  • 9
  • 16

3 Answers3

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
0

No matter you use scripts or monitoring systems. You can used "curl" to check the http status code.

user164485
  • 51
  • 1
  • 6