New DSfW Monitor Script

I previously created two scripts, dsfw_processcheck.sh and dsfw_portchk.sh, one to monitor pids and one to monitor ports.  With the two script they are helpful to ensure the DSfW services are up.  A new script combines the two and adds additional options.  The script not only checks for pids and ports, but it can be used to create a cron job to run the script every 10 minutes by adding the “add” switch.  To remove the cron job use the “rm” switch.

If a DSfW server running DNS (or not) has a DSfW specific process stop or crash a quick stop gap measure is to monitor the DSfW processes and restart them if one or more of the DSfW processes stop.

If the DSfW server is an Additional Domain Controller (ADC) DNS might not be configured on the server.  If DNS is not running on the server remove the novell-named section  from the script to prevent the script from checking for a processes that is not running and thus continuously restarting the DSfW services.

If DNS is configure and has issues starting after eDirectory starts, it does an additional check to ensure both novell-xregd and novell-named are running.

Here are options to configure under the User Configration Section:
# Set RESTART_DSFW to 1 to reload DSfW services if one or more  services are  not running,
# Set RESTART_DSFW to 0 to leave the services in reported state
RESTART_DSFW=1

# Set LOGTOSYSLOG to 1 to send messages to /var/log/messages via a SYSLOG
LOGTOSYSLOG=1

# Set RESET_LOG to 1 to reset the health check log.  Set to 0 to disable or 1 to enable
# If EMAIL_ATTACHMENT=1 then RESET__LOG wil automaticly be set to 1.
RESET_LOG=0

# ADD_JOB is the setting put into the crontab. Must have  $(readlink -f $0) at the end.
ADD_JOB=”*/10 * * * * $(readlink -f $0)”

# Set EMAIL_SETTING to 1 to send e-mail log if an error is returned.  Set to 0 to disable or 1 to enable
EMAIL_SETTING=1

# Set EMAIL_ATTACHMENT to 1 to include log as attachment.  Set to 0 to disable or 1 to enable
EMAIL_ATTACHMENT=0

# $EMAIL_TO = the recipient of the alert email
EMAIL_TO=”rance@novell.com”

To create a cron job manually use the crontab command with the -e switch.  Then enter the desired time to run the script and the script name. Here is an example of creating a cron job to run the script every 10 minutes crontab -e */10 * * * *  /root/bin/dsfw_monitor.sh

Download the script from the DSfW server using the wget command
wget http://dsfwdude.com/downloads/dsfw_monitor.sh

or click on the link Download dsfw_monitor.sh 

Here is an example of the output

====================== DSFW_MONITOR 1.0 =========================
Checking Process IDs for DSfW Services on dsfw1.DSFW.LAN
IP Address: 151.155.213.221
Date: Thu Nov 7 21:14:31 MST 2013
Tree Name: 11_1
Server Name: dsfw1
—————————————————————–
Service                              Status
—————————————————————–
ndsd                                    NO PID
novell-named                 pid exists
nscd                                    pid exists
rpcd                                    pid exists
xadsd                                 pid exists
krb5kdc                            pid exists
kpasswdd                         pid exists
nmbd                                 pid exists
winbindd                          pid exists
smbd                                  pid exists
—————————————————————–
End of process status check
—————————————————————–

—————————————————————–
Service                            Port Status
—————————————————————–
DNS                                 LISTENING
KRB                                 LISTENING
RPC                                 LISTENING
NCP                                 NOT LISTENING
LDAP                              NOT  LISTENING
LDAPS                            NOT LISTENING
GC                                    NOT LISTENING
GCS                                 NOT LISTENING
XADSD                           LISTENING
NetBIOS                        LISTENING
SMB                                 LISTENING
—————————————————————–
End of services actively listening
—————————————————————–

—————————————————————–
Check DSfW ports status with telnet
—————————————————————–
Port 53                         OPEN
Port 88                         OPEN
Port 135                      OPEN
Service NCP on Port 524 is CLOSED
Service LDAP on Port 389 is CLOSED
Service LDAPS on Port 636 is CLOSED
Service GC on Port 3268 is CLOSED
Service GCS on Port 3269 is CLOSED
Port 8025                   OPEN
Port 139                      OPEN
Port 445                     OPEN
—————————————————————–
End of telnet ports status
—————————————————————–
DSfW services are running……
—————————————————————–
DSfW Monitor (dsfw_monitor.sh) has finished.

One Response to New DSfW Monitor Script

Categories