using some Nagios script to check if service is down

Lem0nHead

Verified User
Joined
Nov 28, 2004
Messages
265
hello
I already know http://help.directadmin.com/item.php?id=64 / http://www.directadmin.com/features.php?id=487 , but I believe it would be a good idea if DA came with a better "service down checker" (
I mean, a service checker that waits for a banner/ok on SMTP/POP3 for example (maybe using Nagios scripts)
It already happened many times with me that a service keeps running but stop responding after some bruteforce attack (even after my firewall detects/blocks the IP), so I have to manually restart this service (usually some time later after being wake up by the nagios monitoring server :P)
 
There is no need for that. If you want run nagios somewhere to test. But directadmin does not need it. They would have to build an entire engine that can interpret the nagios scripts.
 
There is no need for that. If you want run nagios somewhere to test. But directadmin does not need it. They would have to build an entire engine that can interpret the nagios scripts.

if you run a nagios script, you will notice it returns something like:
OK, WARNING, CRITICAL
not very difficult to interpret
 
I agree this is not needed. You can run this on your own. Next idea!
 
yes, I can
but what I'm saying is that DA supposily has a feature to check if a service is down
but it's incomplete, because it just check is the process is still running, and in the vast majority of the problems I had on my server, the process WAS running, but not responding

so I just think it would be nice if this "check if service is down" feature got extended to really check if service is down/responding (and not running)
the Nagios script was just an idea... that's not needed, just a script that connects to the service port and wait like 15 seconds for a banner
 
In my opinion DA should be doing less, with service monitoring. DA is a control panel, not a monitoring solution. Nagios for example is more complete than DA should be. In addition, monitoring should be off server.
 
In my opinion DA should be doing less, with service monitoring. DA is a control panel, not a monitoring solution. Nagios for example is more complete than DA should be. In addition, monitoring should be off server.

I agree
but DA doesn't just monitor, it also start a service if it's detected as down
so it's a bit more difficult to do it off server
 
I agree
but DA doesn't just monitor, it also start a service if it's detected as down
so it's a bit more difficult to do it off server

nagios does this too:

http://nagios.sourceforge.net/docs/1_0/eventhandlers.html

Is part of our auto restart service we offer.

And can be done off server. DA only monitors the process, not like nagios which can actually monitor at the application level. Big difference. I've seen many times an application is still running but 'no one home'. Had this happen recently with mod_php.
 
I know, I know, I know
all I am suggesting is that, since DA already has a feature to check if a process is running, it could be extended to check if it's also responding

if someone would disaprove this new feature, please tell why
 
I know, I know, I know
all I am suggesting is that, since DA already has a feature to check if a process is running, it could be extended to check if it's also responding

if someone would disaprove this new feature, please tell why

Easy, because it's not DirectAdmin's core task to check if services are up and running just like empowering was saying. It's a control panel, not a monitoring station.

If you need a more advanced solution, you should look at external monitoring with products like Nagios or Zabbix. You can run it on any VPS so it doesn't have to cost much.
 
Easy, because it's not DirectAdmin's core task to check if services are up and running just like empowering was saying. It's a control panel, not a monitoring station.

If you need a more advanced solution, you should look at external monitoring with products like Nagios or Zabbix. You can run it on any VPS so it doesn't have to cost much.

so what about a suggestion to remove the current feature that check if a service is running?
 
Giving up is probably a good idea. What it appears to me that you're asking for is for DirectAdmin to run something like Nagios (or similar).

Nagios already exists. As do other scripts. You can install them anywhere you want, including on the same server where your'e running DirectAdmin.

So why should DirectAdmin include the code?

I don't see any reason.

If you do, install Nagios on your server. Reason fulfilled :D.

Jeff
 
So why should DirectAdmin include the code?

I don't see any reason.

the reason I saw is "because DA *already* does 'some' monitoring", so I was just suggesting this already existent feature to be extented to become a better monitoring
for me it makes sense:
1) offering no monitoring/restarting at all
2) offering the best monitoring (and I mean checking if service is really up) possible

offering "some monitoring" doesn't seem a good option (and probably makes some people think that's enough for monitoring, when it isn't)
I'm just trying to be logical here, but maybe it isn't logical for everybody, so no problems :)


Edit:
also, DA features shows:
DirectAdmin TaskQueue ensures that all services are up, all of the time. If something crashes, DirectAdmin will attempt to fix the problem by restarting the service. If this fails, DirectAdmin will notify the server administrator immediately.

so here we need to see the definition of "crash"... crash is just when an application get killed? for me not responding is considered a crash


Edit 2:
it may seem I didn't give up, but I did :P
I'm already installing nagios on some servers
just trying to make you understand why I believe my reason is... reasonable :)
 
Last edited:
in case someone is interested, here's a little script that can be adapted for other services:

checksmtp.sh
Code:
#!/bin/sh

EMAIL="email@toReceiveAlertsWhenTheServiceCANbeRestarted"
EMAILALERT="email@toReceiveAlertsWhenTheServiceCAN'TbeRestarted,email2,email3"
FROM="from@email"
SENDMAIL="/root/mymonitoring/mysendmail.pl"
CMD="/usr/local/libexec/nagios/check_smtp -H localhost -t 10 | grep 'SMTP OK'"

if [ -z "`eval $CMD`" ]; then
        /usr/local/etc/rc.d/exim stop

        sleep 2
        killall exim
        sleep 2
        killall -9 exim
        sleep 2
        killall -9 exim
        killall -9 exim

        /usr/local/etc/rc.d/exim start

        if [ -n "`eval $CMD`" ]; then
                echo "SMTP failed, but I restarted it and it seems good now!" | $SENDMAIL $FROM $EMAIL "`hostname`: SMTP failed but restarted OK"
        else
                echo "SMTP failed and I couldn't restart it sucessfully!!" | $SENDMAIL $FROM $EMAILALERT "`hostname`: SMTP DOWN!!"
        fi

fi


mysendmail.pl
Code:
#!/usr/bin/perl

$mail='/usr/sbin/sendmail';

$from=$ARGV[0];
$to=$ARGV[1];
$subject=$ARGV[2];
{ local $/ = undef; $body = <STDIN> }

open (MAIL, "| $mail -t");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
print MAIL "Subject: $subject\n\n";
print MAIL $body;
close MAIL;
 
99.999% of directadmin customers will not have any nagios installed on their box. How is this going to help them if they do not have any nagios check scripts installed?
 
Might want to add those instructions then for someone wanting to try your solution.
 
Back
Top