当前位置:网站首页>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
边栏推荐
猜你喜欢

QTreeView+自定义Model实现示例

Hands on deep learning (34) -- sequence model

入职中国平安三周年的一些总结

Dynamic address book

Hands on deep learning (32) -- fully connected convolutional neural network FCN

Hands on deep learning (III) -- Torch Operation (sorting out documents in detail)

SSM online examination system source code, database using mysql, online examination system, fully functional, randomly generated question bank, supporting a variety of question types, students, teache

How web pages interact with applets

Matlab tips (25) competitive neural network and SOM neural network

Baidu R & D suffered Waterloo on three sides: I was stunned by the interviewer's set of combination punches on the spot
随机推荐
AUTOSAR从入门到精通100讲(106)-域控制器中的SOA
Hands on deep learning (45) -- bundle search
【Day1】 deep-learning-basics
Normal vector point cloud rotation
查看CSDN个人资源下载明细
C language pointer interview question - the second bullet
Servlet基本原理与常见API方法的应用
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
Application of safety monitoring in zhizhilu Denggan reservoir area
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 1
Golang type comparison
Svg image quoted from CodeChina
Exercise 7-8 converting strings to decimal integers (15 points)
Advanced technology management - how to design and follow up the performance of students at different levels
libmysqlclient.so.20: cannot open shared object file: No such file or directory
Dynamic memory management
Exercise 9-5 address book sorting (20 points)
2021-08-11 function pointer
C语言指针经典面试题——第一弹
【OpenCV 例程200篇】218. 多行倾斜文字水印