SybControl Monitoring and Maintenance Package

Public version 1.0, released 12/01/03


What is it?

This is a set of Perl scripts and modules which watch for problems in Sybase database servers, as well as simplifying some site-wide auditing and setup tasks.

Target Environment

Although the sybcontrol scripts are useful for environments from one to hundreds of Sybase servers and replication servers, they were designed with certain assumptions which were true for the environment they were written and initially deployed in. Those assumptions may not be true on your site. The main odd points about our system were: There are probably many other things about the environment these scripts were developed in which may not be true in yours. We are interested in your feedback to either render them more universally applicable or at least document their departures from the norm.

Installation

The open-source Mon::Client and DBD::Sybase modules are necessary for out-of-the-box operation, as is a directory named '/opt/sybase/Sybcontrol', writable by the user which will be running these scripts, for temporary files. With the exception of the files in the 'local' directory, these do not have to be run on the actual data server. In our experience, it's easiest to install the Sybcontrol package on the server you run your ID server on, as the ID server is already in a configuration management role to begin with.

You will need to create an interface file entry called 'SCmaster', or change the scripts to point to whatever server you're going to install the SYBCONTROL database on. The SYBCONTROL tables should be created using the schema in sql/sybcontrol.sql. From there, you insert records into the tables in SYBCONTROL indicating which hosts should be monitored. Inserting records into the tables is not yet well documented, but may be apparent upon inspecting the Perl scripts.


Licensing

Please see the files called LICENSE and GPL.

File List

monitor/perfmaint.pl
monitor/reccheck.pl
monitor/repthreads.pl
monitor/sybprocess.pl
monitor/sybreppulse.pl
GPL
LICENSE
README (non-HTML version of the page you're on now)
local/sybbackup.pl
local/syblogwatch.pl
lib/MonWrap.pm
lib/SybInfo.pm
bin/genif.pl
bin/genschema.pl
bin/synclogins.pl
bin/showmap.pl
bin/spaceused.pl
bin/tables.pl
sql/bouncerepagent.sql
sql/fast_count.sql
sql/sc_production.sql
sql/sc_reorg.sql
sql/sybcontrol.sql
sql/sc_dumpprocs.sql

File Descriptions

monitor/perfmaint.pl
Script which is meant to run nightly and update statistics, reorg compact, and generally keep the server running smoothly without locking tables for access. Also performs some minor auditing, and notes irregularities.

monitor/reccheck.pl
Script which checks table usage amongst all the servers under sybcontrol's eye. Stores space utilization statistics in SYBCONTROL.

monitor/repthreads.pl
Script which connects to each replication server in the system and watches for suspended connections, downed rep agents, etc. It sends alerts if it finds that anything has gone awry.

monitor/sybprocess.pl
Script which connects to each ASE server in the system and checks for locked transactions, space usage nearing maximum, and isql connections.

monitor/sybreppulse.pl
Script which connects to every master database in the system and updates its repl_timestamp table. This provides an easy-to-read view of how far behind a replica is.

local/sybbackup.pl
Script which is meant to be run on the physical server which an ASE is using. It can automatically back up every replicated database on the machine, or it can be instructed as to which to back up. Errors are sent to stdout, which cron then mails to the appropriate person.

local/syblogwatch.pl
Script which watches for activity in Sybase's error logs and sends emails if the logs grow. It's like a 'tail -f' process.

lib/MonWrap.pm
Wrapper module around Mon::Client which greatly reduces the code needed by the various monitoring scripts. By changing this file, one could use NetSaint or any other monitoring system, or just have pages sent via email.

lib/SybInfo.pm
Perl module which simplifies the process of determining which databases are replicated by a given repserver, what the sysusages table is saying about the server in question, etc.

bin/genif.pl
Perl script which dumps the sybservers tables from SYBCONTROL into an interface file. This can be used to validate that everything is being monitored.

bin/genschema.pl
Perl script which dumps schemas from Sybase databases. It is not reliable with certain forms of named defaults, however its main value is writing replication definitions and shell BCP dump/load scripts automatically, to populate subscription replicas with.

bin/synclogins.pl
Perl script used by SA's to set up the 'expected' list of logins on each server, as defined by SYBCONTROL.

bin/showmap.pl
Perl script used by SA's to determine the space utilization of a database. Used for when sybprocess.pl indicates that space is running low.

bin/spaceused.pl
Perl script used to determine approximate row counts and exact space allocation for each table in a database. Can be used to estimate fragmentation.

bin/tables.pl
Useful perl script for listing the tables in a database, or automatically generating DDL to run against them. Often used in conjunction with the other scripts.

sql/bouncerepagent.sql
Stored procedure invoked by repthreads.pl when it detects a rep agent which has gone down. If present, this proc is invoked to restart the rep agent.

sql/fast_count.sql
Stored procedure which returns a table's row count based on Sybase's stats. Those do get out of date, but this is unobtrusive and is a good choice for using with spaceused.pl.

sql/sc_production.sql
Stored procedure used to mark whether or not a server is considered 'production' or not. If the db is production, dev logins active on it will set off an alarm.

sql/sc_reorg.sql
Two stored procedures which perform non-intrusive reorgs on indices and on tables. Using a stored procedure means being able to disable perfmaint.pl's attempts to reorg a certain server by disabling its access to the stored procs.

sql/sybcontrol.sql
Schema for all the control tables in the SYBCONTROL database.

sql/sybstats.sql
Schema for the tables in the SYBSTATS database, which are used to store usage information. This can be used for per-db or per-table trending analysis using tools of your own preference (custom CGIs, Access, etc).

sql/sc_dumpprocs.sql
Two stored procedures for use with sybbackup.pl, one for dumping databases, the other for dumping transactions.


Acknowledgements (in alphabetical order by last name)


SourceForge.net Logo