Nagios Secondary Development (iii) --- nagiosql architecture introduction, nagios --- nagiosql
About NAGIOSQL database structure
I personally think that if you understand the architecture of a system, you should first start with the database, because the database is the soul, and the premise is that the system uses the database. I have just mentioned the architecture. In fact, I really don't know what the architecture is, or whether the first sentence is justified, because I really don't understand development, I have never understood the architecture of a system. Hey.
For a mysql database table, see 1.4.
The tables in this example are the tables used by nagiosql. In the secondary development process, use the default tables as much as possible, because this can minimize the chance of system errors, however, exercise caution when adding fields to a table. One of the main reasons is that nagiosql writes configuration files. During the configuration file writing process, it will select * from table, haha. (In the subsequent articles, I will introduce the solution !)
Below is a brief introduction to several circled tables, which are commonly used. tbl _ is the default prefix and tbl_lnk indicates the joined table:
NAGIOSQL source code structure
The source code structure is as follows:
Note: Other unlabeled files are automatically generated.
NAGIOSQL Runtime
Each page displayed by nagiosqlis displayed through the tpl.htm template in the templatesdirectory. Nagiosql uses a template class called HTML_Template_IT to process, analyze, configure, and display templates. I have to say that the processing mechanism of this template is very old. Apart from the idea which is basically the same as that of the current template, I think the use of this class should be almost forgotten now, because it is indeed not very mainstream, So that you cannot find any materials to introduce and use it. For more information, visit http://pear.php.net/manual/en/package.html.html-template-it.php.
When nagiosql is run for the first time, the index. php page first loads the functions/prepend_adm.php file and sets the session information through the session_start () method on this page. The status saving and permission control after logon are also basically based on sessions, thanks to the powerful session function of php. The prepend_adm.php file controls the page display, which is the data source of the internal template (package file header, and the webpage contains main.tpl.htm. Functions/nag_class.php controls the left menu and data sources on the insert, delete, and change pages. The admin_master.tpl.htm template page controls the main content of each page.
Their mappings are as follows:
Please indicate the source when you repost it, because I want to help you discuss it with me more conveniently. Thank you.
Comments and suggestions: ruberzhu@qq.com