sadm_server_sunrise.sh

4 minute read

NAME

sadm_server_sunrise.sh
Collect & process data produced by all actives clients

SYNOPSIS

sadm_server_sunrise.sh [-d 0-9] [-h] [-v]
$SADMIN/bin/sadm_server_sunrise.sh - v2.8
Posted 2021-05-26 - Updated 2021-06-03
Supported on Linux
Can only be run on SADMIN Server.

DESCRIPTION

This script have multiple functions :
1- First, it make sure that your $SADMIN directories permissions and ownerships are inline with the one you specified in the SADMIN configuration file. This is the responsibility of the sadm_server_housekeeping.sh script.

2- Secondly, it collect all the latest performance data and configuration of all your actives clients. This is the responsibility of the sadm_daily_farm_fetch.sh script.

3- It then update the SADMIN database with the latest system information files just collected.
This is the responsibility of the sadm_database_update.py script.

4- It is responsible to update the rrd database (Round Robin Database) that allow you to view the performance graph of your systems.
This is done by the sadm_nmon_rrd_update.sh script.

5- The next step is to scan the network subnet you selected to give you an exact picture of your IP usage and take a backup of your SADMIN database.
This step is done by the sadm_subnet-lookup.py script.

6- Finally, a backup of the SADMIN database is taken by the sadm_backupdb.sh script.

This script does a lot of things but actually all it does is to start the six scripts that will do each a different job. It has to run early in the morning, so when you wake up or arrive to work you have the latest information about your systems. You may change the execution time if you want in “/etc/cron.d/sadm_server” but it as to run early in the morning and after the “sadm_client_sunset.sh” script on the clients. The “sadm_client_sunset.sh” script is the one that generate the latest data that this script is collecting and processing.

Portion of server crontab that execute this script

# cat /etc/cron.d/sadm_server 
...
# Early every morning - Collect Perf data, Update & backup DB, Network scan, Housekeeping
05 05 * * * sadmin sudo ${SADMIN}/bin/sadm_server_sunrise.sh >/dev/null 2>&1
...

This script is responsible to run these six scripts once a day

sadm_server_housekeeping.sh (1)

  • Make sure all the server files in “$SADMIN” have proper owner, group and permission
  • Remove files older than 7 days in “$SADMIN/tmp” directory
  • Remove pid files (once a day) in “$SADMIN/tmp” directory
  • Archive alert older than 30 days to $SADMIN/cfg/alert_archive.txt
  • Remove *.rch files in “${SADMIN}/dat/rch” older than “${SADM_RCH_KEEPDAYS}
  • Remove *.log files in “${SADMIN}/log” older than “${SADM_LOG_KEEPDAYS}
  • Remove *.nmon files in “${SADMIN}/dat/nmon” older than “${SADM_NMON_KEEPDAYS}
  • Check existence on the server of “$SADMIN_USER” and “$SADMIN_GROUP
  • Verify if “$SADMIN_USER” is not lock or the password is expired

sadm_daily_farm_fetch.sh (2)

  • Sync clients disaster recovery directory “$SADMIN/dat/dr” to local “$SADMIN/www/dat/$server/dr”
  • Sync clients performance data files “$SADMIN/dat/nmon” to local “$SADMIN/www/dat/$server/nmon”

sadm_database_update.py (3)

  • Update the SADMIN server database with information collected the Daily Farm Fetch

sadm_nmon_rrd_update.sh (4)

  • Update the performance statistics database (rrd) with the data that was just collected

sadm_subnet-lookup.py (5)

  • Scan the network subnet specified in sadmin.cfg and update the sadmin database

sadm_backupdb.sh (6)

  • Do a backup of all MySQL Databases

Back to the top

EXAMPLE

================================================================================
Thu May 27 05:05:05 EDT 2021 - sadm_server_sunrise.sh V2.8 - SADM Lib. V3.70
Server Name: holmes.maison.ca - Type: LINUX
CENTOS 7.9.2009 Kernel 3.10.0-1160.25.1.el7.x86_64
==================================================
 
Running /sadmin/bin/sadm_server_housekeeping.sh ...
[ SUCCESS ] Running /sadmin/bin/sadm_server_housekeeping.sh
Running /sadmin/bin/sadm_daily_farm_fetch.sh ...
[ SUCCESS ] Running /sadmin/bin/sadm_daily_farm_fetch.sh
Running /sadmin/bin/sadm_database_update.py ...
[ SUCCESS ] Running /sadmin/bin/sadm_database_update.py
Running /sadmin/bin/sadm_nmon_rrd_update.sh ...
[ SUCCESS ] Running /sadmin/bin/sadm_nmon_rrd_update.sh
Running /sadmin/bin/sadm_subnet_lookup.py ...
[ SUCCESS ] Running /sadmin/bin/sadm_subnet_lookup.py
Running /sadmin/bin/sadm_backupdb.sh ...
[ SUCCESS ] Running /sadmin/bin/sadm_backupdb.sh

==================================================
Script exit code is 0 (Success) and execution time is 00:33:21
History (/sadmin/dat/rch/holmes_sadm_server_sunrise.rch) trim to 35 lines.
Script will send an alert only when it terminate with error ($SADM_ALERT_TYPE=1).
Script succeeded, no alert will be send to 'default' alert group.
New log (/sadmin/log/holmes_sadm_server_sunrise.log) created ($SADM_LOG_APPEND='N').
End of sadm_server_sunrise.sh - Thu May 27 05:38:23 EDT 2021
================================================================================

Back to the top

OPTIONS

Options Description
[ -d 0-9 ] Set debug level from 0 to 9 (Default is 0)
[ -h ] Display this help and exit.
[ -v ] Output version information and exit.

ENVIRONMENT

  • The “$SADMIN” environment variable must be defined and contains the root directory of the SADMIN tools (normally /opt/sadmin). It should be already done, the setup script have updated the ‘/etc/profile.d/sadmin.sh’ and the ‘/etc/environment’ files.
  • The SADMIN configuration file, is needed and loaded in memory at the beginning of every scripts. This file should already exist and contains your SADMIN configuration and preference setting.
  • For Shell script the Shell Library is used and for Python script the Python Library is used.

EXIT STATUS

Exit Code Description
0 An exit status of zero indicates success.
1 Failure is indicated by a nonzero value, typically ‘1’.

AUTHOR

Jacques Duplessis
Any suggestions or bug report can be submitted at the support page

Copyright © 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
This is free software, you are free to change and redistribute it.
There is NO WARRANTY to the extent permitted by law.

SEE ALSO

sadm_server_housekeeping.sh - Purge old log,rch,nmon files and check $SADMIN permission
sadm_daily_farm_fetch.sh - Collect Hardware/Software/Performance data from actives servers
sadm_database_update.py - Take data collected from clients and update database
sadm_nmon_rrd_update.sh - Daily performance database update
sadm_subnet-lookup.py - Scan network selected subnet & store info in database
sadm_backupdb.sh - Backup one or all MySQL/MariaDB databases on the system
sadmin.cfg - SADMIN main configuration file
System Information File - Documentation about the system information file
sadm_client_sunset.sh - Clients end of day housekeeping and producing system information files