How to use DirectAdmin to create your own service monitoring

Source: Internet
Author: User

Add the following in services. status:

The code is as follows: Copy code

Servicename = ON

Or:
 
Servicename = OFF

If the service name is in this list, ON indicates that dataskq will monitor the service, and OFF means no monitoring. Similar to other functions, if you click "stop" ON the DirectAdmin panel, directAdmin also sets the value above to OFF.

In addition, the following code is still useful and can be used to customize services for monitoring.

Many administrators run a lot of software on Linux systems. DirectAdmin does not check and monitor them to ensure they are running all the time. The following script allows administrators to monitor the running status of the program, as an example, we monitor a spamd program here. Replace the following content with your own information:
 

The code is as follows: Copy code
#! /Bin/sh
COUNT = 'PS-ax | grep-v grep | grep-c spamd'
If [$ COUNT-eq 0]; then
# The command used to start spamd
/Usr/bin/spamd-d-c-m 5
 
Sleep 3
 
COUNT = 'PS-ax | grep-v grep | grep-c spamd'
If [$ COUNT-eq 0]; then
Echo-e & amp; quot; Subject: spamd is downnnspamd is downn. nn & amp; quot; |/usr/sbin/exim your@email.com
Fi
Fi
Exit 0;

After changing this script to your own script, use the chmod command to change its permission to 755, and then set a regular script to check whether the script is running, directAdmin will check the running status of the program once every minute. However, the script cannot determine whether an email is sent after the program fails, so if your program is always there, your mailbox is expected to receive a warning email every minute, so it is enough to set the monitoring interval to 5 to 10 minutes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.