If the data area of the database instance DEMODB on the PARMA database computer is full, the database instance should trigger the DATABASEFULL event. An event dispatcher should then call the mail program, which sends an e-mail to the administrator responsible using the e-mail address admin@example.com.
...
1. Create a file dbfull.txt on the PARMA database computer in the <user_home>/sdb directory. You enter e-mail text for the administrator in this file.
The DATABASEFULL event is always active. You thus do not need to activate this event with the DBM command event_set.
2. You add a new entry to the testconfig.cfg configuration file in the <user_home>/sdb directory with the add command:
dbmevtdisp add ~/sdb/testconfig.cfg Name == DATABASEFULL Priority == LOW Command == "bash –c \"mail –s 'Database DEMODB on PARMA is full.' admin@example.com < ~/sdb/dbfull.txt\""
OK
1
In order to ensure that the event dispatcher transfers the mail command in full, you mask the double quotation marks before the key word mail and after dbfull.txt.
The event dispatcher cannot start the mail program directly to read the e-mail body from a file but has to call it in a separate shell.
3. You start the event dispatcher from your computer on the PARMA database computer with the authentication data of the DBM operator OLEG using the following command:
dbmevtdisp start ~/sdb/testconfig.cfg –l ~/sdb/test.log –d DEMODB –u OLEG,MONDAY –n PARMA
Event Dispatcher instance 1 running
using configuration file ~/sdb/testconfig.cfg
event with name DISPINFO:DISPSTART not dispatched (count 0)
The event dispatcher has been started on the PARMA computer and is now monitoring the DEMODB database instance on the same computer. The event dispatcher logs its actions in the test.log log file.
The event dispatcher triggers the DISPINFO:DISPSTART event every time it is started. As you have not added an entry for this event to the configuration file, you receive the message not dispatched.
To enable event dispatchers for various database computers on various database instances to use the same configuration file, replace the name of the database instance and the name of the database computer in the configuration file using the \$DBNAME\$ and \$SERVERNAME\$ variables.
To prevent the shell interpreting these variables as environment variables, mask the variable names.
For more information, see the description for the add command.