当前位置:网站首页>Development guidance document of CMDB
Development guidance document of CMDB
2022-07-04 10:10:00 【Stestack】
Cmdb Developing documents
Catalog
Cmdb Developing documents ... 1
1 Deployment instructions ... 1
1.1 Environmental statement ... 1
1.3 Clone deployment code ... 2
2.1 Description of the purpose of each data sheet ... 5
2.2 assets_host Table structure design ... 6
2.3 Computer room management ... 9
3 Automatic operation and maintenance ... 9
1 Deployment instructions
1.1 Environmental statement
Python Environmental Science :Python2.7
Django Environmental Science Django1.7.4
1.2 Django Of MTV Model
1.3 Clone deployment code
git clone https://github.com/voilet/cmdb
mv cmdb /data
cd /data/cmdb
pip install -r requirements.txt --index https://pypi.mirrors.ustc.edu.cn/simple/
Some may not have the need to install database construction
pip install MySQL-python
establish mysql Database and authorize account login :
Ø create database cmdb_v2 default charset=utf8;
Import database table file :
doc/cmdb.sql
insert data :
INSERT INTO `users_department_mode` VALUES (1,' Operation and maintenance department ','',1001);
insert into `users_customuser` (`id`, `password`, `last_login`, `is_superuser`, `email`, `username`, `first_name`, `last_name`, `department_id`, `mobile`, `session_key`, `user_key`, `menu_status`, `user_active`, `uuid`, `is_staff`, `is_active`, `date_joined`) values('1','pbkdf2_sha256$15000$uM1f5HMxHOqE$zPzKtNJMheQe62Q592V5l0m60nq/5Vj4rgzlVf5nXYs=','2016-08-04 14:12:56','1','[email protected]','admin','','',NULL,'','ff3a3s4vj7ivjl7km1teqhxrizwbdrek',NULL,'1','0','3eceb1e9-df90-38ed-9960-03183bc85cce','0','1','2015-12-29 14:05:50');
4、 Modify the configuration file mysite/settings.py:( This can be modified later )
EMAIL_HOST = 'mail.qq.com'
EMAIL_PORT = '25'
EMAIL_HOST_USER = 'devops'
EMAIL_HOST_PASSWORD = '123456'
EMAIL_USE_TLS = False
EMAIL_PUSH = True
# Email account
SendMail = "[email protected]"
REDIS_HOST = "127.0.0.1"
REDIS_PORT = 6379
REDIS_DB = 0
Modify the configuration file mysite/prod.py:( Database correlation , Must be modified )
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': 'voilet_cmdb_v1', # Or path to database file if using sqlite3.
'NAME': 'cmdb_v2', # Or path to database file if using sqlite3.
'USER': 'root',
'PASSWORD': '123456', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '3306', # Set to empty string for default. Not used with sqlite3.
"OPTIONS": {
"init_command": "SET foreign_key_checks = 0;",
},
},
Modify the boot configuration file uwsgi:( Must be modified , among /home/jm/uwsgi Change to the actual path )
DESC="uwsgi daemon"
NAME=uwsgi
DAEMON=/usr/bin/uwsgi
CONFIGFILE=/data/cmdb/mysite_uwsgi.ini
PIDFILE=/data/cmdb/mysite.pid
SCRIPTNAME=/etc/init.d/$NAME
Modify site profile mysite_uwsgi.ini:( Change to the actual address )
chdir = /data/cmdb
5 And then copy the program to /etc/init.d/
cp uwsgi /etc/init.d/uwsgi
6 Add nginx The host is configured to nginx.conf( among /data/cmdb Actual address )
server {
listen 80;
server_name cmdb.com;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
location /static {
alias /data/cmdb/static;
}
location /static/admin {
alias /usr/local/python2.7/lib/python2.7/site-packages/django/contrib/admin/static/admin;
}
location /static/ueditor {
expires 30d;
alias /data/cmdb/DjangoUeditor/static/ueditor;
}
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8100;
}
}
7 Start
service nginx reload
/etc/init.d/uwsgi start
notes :uwsgi adopt /etc/init.d/uwsgi stop Unable to close , It can be closed by directly killing the process
Open the web page to visit
Default password admin: Admin_147258
8 After logging in
First create a product line , Then create the project , Machine room under construction
Then add the service
2 Asset management
2.1 Description of the purpose of each data sheet
| AuthNode |
| AuthSudo |
| assets_conftemplate |
| assets_host | # Server information table
| assets_host_business | # Server and project correspondence table
| assets_host_service | # Server and service correspondence table
| assets_hostrecord | #cmdb User operation host record
| assets_idc | #idc Machine room information table
| assets_iplist | #ip list
| assets_line | # Product line data sheet
| assets_project | # Service and project correspondence table
| assets_projectuser | The user of the project
| assets_service | # Service information table
| assets_zabbixrecord | #zabbix Information sheet
| audit_ssh_audit | # Log audit - Command record table
| auth_group | #django Default automatic grouping
| auth_group_permissions | #django Default group permissions
| auth_permission | #django Permissions on the table
| cmdb_auth_auth_group | #django Authenticated group permission table
| cmdb_auth_auth_group_group_user | # User association table
| cmdb_auth_user_auth_cmdb | # Permissions on the table , by false There is no authority
| django_admin_log |
| django_content_type | #django Model
| django_migrations | # Database change operation record
| django_session | #session Information records ( The new permission will be written session in )
| gitCode | #git Code record
| incident |
| monitor_monitorhttp | # monitor http Table record of data
| monitor_monitorhttplog | # monitor http Data logging
| monitor_monitormysql | # monitor mysql Table record of data
| project_swan |
| project_swan_node |
| project_swan_push_user |
| push_system |
| salt_ui_operationlog | #
| salt_ui_salt_api_log |
| salt_ui_salt_conf |
| salt_ui_salt_mode_name |
| salt_ui_setuplog |
| swan_apply |
| swan_swanlog |
| users_customuser | #cmdb User information sheet
| users_customuser_groups | #cmdb User group information table
| users_customuser_user_permissions | # User table and permission correspondence table
| users_department_mode | # Department information sheet
| users_departmentgroup | # Department group information
| users_server_auth |
2.2 assets_host Table structure design
+-------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| uuid | char(32) | NO | PRI | NULL | | #uuid
| node_name | varchar(100) | YES | | NULL | | # Host name
| eth1 | char(15) | YES | | NULL | | #eth1 network card ip
| eth2 | char(15) | YES | | NULL | | #eth2 network card ip
| mac | varchar(20) | YES | | NULL | | #MAC Address
| internal_ip | char(15) | YES | | NULL | | # Remote control card IP
| brand | varchar(64) | YES | | NULL | | # Server model
| cpu | varchar(64) | YES | | NULL | | #cpu Model description
| hard_disk | varchar(128) | YES | | NULL | | # Hard disk description
| memory | varchar(128) | YES | | NULL | | # Memory description
| system | varchar(32) | YES | | NULL | | # operating system
| system_cpuarch | varchar(32) | YES | | NULL | | # The operating system is platform based
| system_version | varchar(8) | YES | | NULL | | # System version
| create_time | datetime | NO | | NULL | | # Record creation time
| guarantee_date | date | YES | | NULL | | # Expiration time of server over warranty
| cabinet | varchar(32) | YES | | NULL | | # Cabinet
| server_cabinet_id | int(11) | YES | | NULL | | # The position of the cabinet where the machine is located
| number | varchar(32) | YES | | NULL | | # Serial number
| editor | longtext | YES | | NULL | | # Machine remarks
| status | int(11) | NO | | NULL | | # The current state of the server
| type | int(11) | NO | | NULL | | # Type of machine , Physical machine or virtual machine
| Services_Code | varchar(16) | YES | | NULL | | # Express service number
| env | varchar(32) | YES | | NULL | | # The environment of the machine
| room_number | varchar(32) | YES | | NULL | | # Room number of machine room floor
| server_sn | varchar(32) | YES | | NULL | | # The server sn Number
| switch_port | varchar(12) | YES | | NULL | | # Corresponding switch port
| idle | tinyint(1) | NO | | NULL | | # Are you free — This field is useless
| idc_id | char(32) | YES | MUL | NULL | | # Corresponding machine room id
| vm_id | char(32) | YES | MUL | NULL | | # Is the corresponding virtual machine
+-------------------+--------------+------+-----+---------+-------+
About asset management - Machine scrapping
from cmdb Delete this server in the system
Asset management increased raid Field
Add fields to the database
Model Add fields
Write fields to file
Synchronize the fields in the file to the database ( Found an error )
Force update to database
The fields in the table have been generated by querying the database
2.3 Server export
First static Under the directory, you need to create pdf Catalog
Secondly, repair -- Export all servers as virtual machines bug
The correct result can be derived after judgment .
2.3 Computer room management
desc assets_idc Field description
+-------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| uuid | char(32) | NO | PRI | NULL | | # Computer room uuid
| name | varchar(64) | NO | | NULL | | # Name of machine room
| bandwidth | varchar(64) | YES | | NULL | | # Bandwidth size
| phone | varchar(32) | NO | | NULL | | # Computer room contact number
| linkman | varchar(32) | YES | | NULL | | # Computer room contact
| address | varchar(128) | YES | | NULL | | # Machine room address
| network | longtext | YES | | NULL | | #IP Address segment
| create_time | date | NO | | NULL | | # Record creation time
| operator | int(11) | YES | | NULL | |
| type | int(11) | YES | | NULL | | # Machine room type
| comment | longtext | YES | | NULL | | # remarks
+-------------+--------------+------+-----+---------+-------+
3 Automatic operation and maintenance
4 Business monitoring
5 fault management
边栏推荐
- Exercise 9-5 address book sorting (20 points)
- Check 15 developer tools of Alibaba
- 使用 C# 提取 PDF 文件中的所有文字(支持 .NET Core)
- uniapp 小于1000 按原数字显示 超过1000 数字换算成10w+ 1.3k+ 显示
- MySQL case
- Deep learning 500 questions
- PHP student achievement management system, the database uses mysql, including source code and database SQL files, with the login management function of students and teachers
- JDBC and MySQL database
- Exercise 9-3 plane vector addition (15 points)
- Exercise 9-4 finding books (20 points)
猜你喜欢
How web pages interact with applets
Hands on deep learning (40) -- short and long term memory network (LSTM)
Custom type: structure, enumeration, union
智慧路灯杆水库区安全监测应用
C language pointer interview question - the second bullet
今日睡眠质量记录78分
Log cannot be recorded after log4net is deployed to the server
Mmclassification annotation file generation
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 1
MATLAB小技巧(25)竞争神经网络与SOM神经网络
随机推荐
Summary of small program performance optimization practice
品牌连锁店5G/4G无线组网方案
MongoDB数据日期显示相差8小时 原因和解决方案
MySQL case
Exercise 7-3 store the numbers in the array in reverse order (20 points)
Hands on deep learning (33) -- style transfer
libmysqlclient.so.20: cannot open shared object file: No such file or directory
技术管理进阶——如何设计并跟进不同层级同学的绩效
el-table单选并隐藏全选框
7-17 crawling worms (15 points)
Write a jison parser from scratch (3/10): a good beginning is half the success -- "politics" (Aristotle)
Write a jison parser from scratch (6/10): parse, not define syntax
Exercise 8-7 string sorting (20 points)
A little feeling
El Table Radio select and hide the select all box
Regular expression (I)
Native div has editing ability
查看CSDN个人资源下载明细
Mmclassification annotation file generation
Normal vector point cloud rotation