File: myerrorlog.htm

package info (click to toggle)
moodss 19.7-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,136 kB
  • ctags: 3,149
  • sloc: tcl: 49,048; ansic: 187; perl: 178; makefile: 166; sh: 109; python: 65
file content (86 lines) | stat: -rw-r--r-- 7,390 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html>
<head>
<title>MySQL myerrorlog moodss module</title>
</head>
<body>

<p>This is a module for monitoring the MySQL SQL database server error log (latest versions in the 4 series).

<p>On UNIX type platforms, it requires the mysqltcl package (at <a href="http://www.xdobry.de/mysqltcl/">http://www.xdobry.de/mysqltcl/</a>) for connection via the native MySQL protocol, or the tclodbc package (at <a href="http://tclodbc.sourceforge.net/">http://tclodbc.sourceforge.net/</a>) for connection via ODBC (Open DataBase Connectivity).
<br>On Windows platforms, please read the <i>install.txt</i> file.

<pre><img src="myerrorlog.gif" alt="view of the myerrorlog module tables"></pre>

<p>Data is displayed in 1 table with the following columns:

<ul>
<li>message <b>type</b>: <i>new</i> for messages that occurred during the last poll, <i>old</i> for messages that occurred before the last poll, <i>top</i> being for the most important message among the <i>new</i>.
<li>importance <b>level</b> of the message, the higher the value the more important the message, according to the following standard classification (from UNIX <i>syslog</i>): <i>0</i> (<i>debug</i>), <i>1</i> (<i>info</i>), <i>2</i> (<i>notice</i>), <i>3</i> (<i>warning</i>), <i>4</i> (<i>error</i>), <i>5</i> (<i>critical</i>), <i>6</i> (<i>alert</i>), <i>7</i> (<i>emergency</i>).
<li><b>date</b> of latest message occurrence of its sort.
<li><b>time</b> of latest message occurrence of its sort.
<li>number of <b>occurrences</b> of this sort of message since this module was launched.
<li>text of the latest <b>message</b> of its sort (may be empty for the <i>top</i> type row if there were no <i>new</i> messages).
</ul>

<p><b>Behavior:</b>

<p>When the module is launched, a few MySQL variables, such as the data directory, are retrieved from the server using a query. Then the server error log file is monitored for new messages, which when they appear are sorted according to their importance level and their time of occurrence. Note that all messages are regrouped according to their format and their number of occurrences displayed.

<p>The latest messages are marked as <i>new</i>, with older messages from previous polls displayed with the type <i>old</i>, up to the maximum number of rows (see <i>--rows</i> option). Note that there always is a message of type <i>top</i>, which is the most important message among the <i>new</i>. This particular message row may be empty if there were no new messages during the last poll interval, which allows the administrator to set a threshold on the presence of text in the <i>message</i> column of the <i>top</i> row, in order for example to be warned by an email message containing the most important error message when it occurs.

<p>Monitoring remote server requires remote shell functionality (using <i>rsh</i> or the recommended <i>ssh</i>), since the error log, by its nature, cannot be accessed using a SQL query.

<p><b>Module options:</b>

<ul>
<li><i>--debug-file</i>
<br>If you see messages with an unknown importance <b>level</b> (displayed as <i>?</i>), please contact the author (<i>jfontain@free.fr</i>) so that they can be integrated in the next module release. You can use this option to specify a file (that you have rights to create) where these messages will be automatically stored. You can then attach this file to your email message to make a complete report.
<br>If you use this option, please also use the <i>--whole</i> option so that the error log file is completely scanned for unknown messsages.
<li><i>--dsn</i>
<br>ODBC Data Source Name (see your database/system administrator if in doubt). In this case, the tclodbc package is used for connecting to the database. This option is incompatible with the <i>--p (--port)</i> option.
<li><i>-f (--file)</i>
<br>The MySQL error log file path. Can be used for example on Windows platform when the database server is not local but its error log file is shared (as a network accessible file, see examples).
<li><i>-p (--port)</i>
<br>Port used by the database server. <i>3306</i> is used internally if not specified.
<li><i>--user</i>
<br>Database user name (defaults to current user).
<li><i>--password</i>
<br>Database password for user (no default).
<li><i>-r (--remote) [[rsh|ssh]://][user@]host</i>
<br>Must be specified if the database server is not running on the local host.
<br>There are 2 cases:<ul>
  <li>The <i>-f</i>(<i>--file</i>) option is used (see above), in which case only the <i>host</i> part is used along with the <i>--user</i> and <i>--password</i> options for connecting to the database (the <i>protocol</i> and <i>user</i> parts are ignored).
  <li>The <i>-f</i>(<i>--file</i>) option is not used, in which case remote login using <i>user</i> as logname on remote host <i>host</i> is used (<i>rsh</i> or <i>ssh</i> facilities must be properly setup). If <i>user</i> is not specified, current user is used as logname on remote host. The protocol is either <i>ssh</i> or <i>rsh</i> (used by default).
</ul>
<i><b>Note</b>: do not confuse this remote file access with the database user and password options.</i>
<li><i>--rows</i>
<br>Limits the number of rows displayed in the module table. Defaults to <i>10</i>. Using a <i>0</i> value removes that limitation, which may be useful if one wants to get a summary of the database server error log (see also the <i>--whole</i> option).
<li><i>--whole</i>
<br>If specified, the whole MySQL error log will be read and parsed initially so that all messages (up to the limit imposed by the <i>--rows</i> option) will be displayed when the module is launched. Be warned that using this option may result in very long start up times, depending on your processor speed and eventually the bandwidth to the remote database server.
</ul>

<p><b>Examples:</b>

<ul>
<li>View all the sorted error messages on the local server:
<pre>$ moodss myerrorlog --whole --rows 0</pre>
<li>Monitor a remote UNIX server from UNIX using a secure channel:
<pre>$ moodss myerrorlog -r ssh://dbserver.company.com --user status --password xxx</pre>
Note that you should first check that ssh is properly configured first, so that the following command, for example, works:
<pre>$ ssh dbserver.company.com cat /var/lib/mysql/dbserver.company.com.err</pre>
<li>Monitor a remote UNIX server from Windows (the <i>dbserver</i> value of the <i>-r</i> option is a <i>putty</i> saved configuration):
<pre>$ moodss myerrorlog -r dbserver --user status --password xxx</pre>
Note that you should first check that putty is properly configured first, so that the following command, for example, works:
<pre>C:\&gt; putty dbserver cat /var/lib/mysql/dbserver.company.com.err</pre>
<li>Monitor a remote Windows server from Windows using a shared error log directory:
<pre>C:\&gt; moodss myerrorlog --remote 192.168.0.10 --file "\\Server\mysql\data\mysql.err"</pre>
<li>Monitor a remote Windows server from UNIX using a shared error log directory:
<pre>$ moodss myerrorlog --remote 192.168.0.10 --file "/mnt/mysql/mysql.err"</pre>
<li>Monitor a server using ODBC and rsh:
<pre>$ moodss myerrorlog --dsn mydb --remote 192.168.0.10</pre>
</ul>

<p>You may set a threshold on the importance <i>level</i> column of the <i>top</i> row, in order for example to be warned with an email message when a critical message arrives (level greater or equal to <i>5</i>).

</body>
</html>