In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
AutoOps
AutoOps is based on version 2.0 django development, mainly for linux operation and maintenance engineers to use, manage linux asset information, Mysql database, batch execution of commands, scripts, access to traffic diagrams, web ssh management, technical documents and other functions.
Welcome to test and use, you can feedback if you have any questions.
Demo
Address: http://114.115.132.147:8003 account admin password 1qaz.2wsx
Communication group number: 620176501 Welcome to communicate!
Backend address http://114.115.132.147:8003/admin account number admin password 1qaz.2wsx
Blog: http://hequan.blog.51cto.com/
Github: https://github.com/hequan2017/autoops/
Ma Yun: https://gitee.com/hequan2020/autoops
Architecture diagram
Update record
The preview version enhances the query and display function of mysql.
1.7.8 change the background to xadmin
Tasks.task. Task
Tasks.task.monitor_job # regularly acquire CPU, memory and traffic
Tasks.task.clean_history_host_monitor # clears the host performance history data from one week ago
Tasks.task.cmd_job # can execute commands regularly, enter host, and commands can be used.
Note: xadmin does not support object permission component django-guardian. When you need to set it, you can log in to dadmin (the default admin)
Note: xadmin does not recognize the name of the tasks task. The required name is as follows:
1.7.7 change the webssh startup mode.
1.7.6 the code base function is online with distribution.
1.7.4 update the ansible version. Enhance command line functionality. The specific method refers to the ansible module.
1.6 Mysql database operations: automatic audit + execution (currently only applicable to Mysql)
Update django to 2.0
1.3 add a new technical documentation section.
1.2 the authority management is perfect. Add attachment upload and download function.
1.1.5 add permission management. Distinguish different permissions according to the background user group. Such as: first build a test machine group in the background, and add ordinary users to this group. When adding assets at the front end, a test machine appears in the product line. The users under the test set only manage the assets of the product line of the test machine.
1.1 add functions such as platform login record, web login record, password modification and so on.
Function
Asset assets
Api http://114.115.132.147:8003/asset/api/asset.html
Get server information automatically
Export all
CPU memory flow graph
Names user (reservation module)
Encryption and decryption password_crypt.py # # if it is your own production environment, it is recommended to change the key in it.
Tasks task
Shell
Python
Command Lin
Tools
Webssh login
Learn from https://github.com/huashengdun/webssh on github
Library technical documents (the management platform for real operation and maintenance personnel, with their own technical documents, you don't have to look elsewhere if you have any problems)
DjangoUeditor Rich text Editor
Code base
Code base
Host distribution
Database automatic audit-command execution rollback
Inception
back-stage management
Admin
Distinguish according to the background user group. Admin has the highest privileges.
For example: new operation and maintenance group, development group, hequan account in new operation and maintenance group
Then hequan can only see the servers and databases under the operation and maintenance group, and the execution tools can only select the operation and maintenance group. Hequan could not add server, database.
Environment
Python 3.6.4 # refer to script/install_python3.6.4.py
Django 2.0
Python 2.7 (used to start supervisor)
Centos 7.4
Supervisor management cannot
Uwsgi web service startup
Webssh
Celeryd queue task
Celerybeat
Celerycam
Celeryflower
Inception mysql database audit
Installation
Development environment deployment:
1. Download and install the basic environment, the installation directory is / opt, if other directories, please modify the corresponding settings in supervisor.conf.
Cd / opt yum install git sshpass redis-y systemctl enable redis.service systemctl start redis.service git clone https://github.com/hequan2017/autoops.git cd autoops/ pip3 install-r requirements.txt cd / usr/local/src wget https://codeload.github.com/sshwsfc/xadmin/zip/django2 unzip django2 cd xadmin-django2/ python setup.py install
In the added assets, it is recommended that you execute yum install ipmitool dmidecode-y to get more information
Install supervisor
There is no pip2 version of chmod + x / opt/autoops/script/inception/bin/* pip2 install supervisor # # You can refer to script/install_pip2.sh echo_supervisord_conf > / etc/supervisord.conf mkdir / etc/supervisord.d/ vim / etc/supervisord.conf # # to set [inet_http_server] # # HTTP login account password port=0.0.0.0:9001 username=user password=321 [include] files = / etc/supervisord.d/*.confcp / opt/autoops/script/supervisor.conf / etc/supervisord.d/ environment settings
Database: please modify the autops/settings file, if there is no mysql, please choose the one above. If so, you can enable mysql to set the relevant connection address. For the installation method of mysql, please refer to my blog http://hequan.blog.51cto.com/5701886/1982428
DATABASES = {'default': {' ENGINE': 'django.db.backends.sqlite3',' NAME': os.path.join (BASE_DIR, 'db.sqlite3'),}} DATABASES = {' default': {'ENGINE':' django.db.backends.mysql', 'NAME':' autoops', 'USER':' root' 'PASSWORD':' 123456, 'HOST':' 192.168.10.24, 'PORT':' 3306,}}
Modify autoops/settings custom parameters
DEBUG = True # # for use in the actual production environment, please close the address False BROKER_URL = 'redis://127.0.0.1:6379/0' # # Redis. Generally, you don't need to modify the access IP of Webssh_ip =' 114.115.132.147' # WebSSH software, that is, the external network IP of the local machine. Just change this place. Webssh_port='9000' # # port number. Default is fine. If there is any modification, you need to modify the webssh/main.py file define ('port', default=9000, help='listen port', type=int) Inception_ip =' 127.0.0.1'# # this is the Inception software address, and the default is the local address Generally, you do not need to modify Inception_port = '6669' # # this sets the parameters related to the rollback backup (mysql) server for the Inception software port number inception_remote_system_password='654321' # #, and synchronously modifies the settings in script/inc.cnf inception_remote_system_user='root' inception_remote_backup_port='3306' inception_remote_backup_host='192.168.10.100' # # to set the backup database address
Modify a file / usr/local/lib/python3.6/site-packages/django/db/backends/mysql/base.py comment 35 36 below two lines, can not be found can be ignored.
If version
< (1, 3, 3): raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__) 由于Inception 并不原生支持pymysql,所以需更改pymysql相关源码。 在script/ 文件夹下有已经修改的connections.py 和 cursors.py 直接替换即可。 替换位置为 /usr/local/lib/python3.6/site-packages/pymysql 下的 connections.py 和 cursors.py 两个文件 注: 如果想知道,修改了哪里,可参考script/备注。 cp /opt/autoops/script/connections.py /usr/local/lib/python3.6/site-packages/pymysql/connections.py cp /opt/autoops/script/cursors.py /usr/local/lib/python3.6/site-packages/pymysql/cursors.py 初始化数据库(可删除文件夹的 db.sqlite3) python manage.py makemigrations python manage.py migrate python manage.py createsuperuser ##创建管理员 autoops 登陆的端口号 在 supervisor.conf 里面 第2行 ,默认是 0.0.0.0:8003 。如有修改端口号,请把supervisor 里的uwsgi 服务关闭,再启动。 启动supervisor进程管理 /usr/bin/python2.7 /usr/bin/supervisord -c /etc/supervisord.conf 加到linux 开机启动里面 chmod +x /etc/rc.d/rc.local 把上面的命令放到这个文件里面 启动: 统一用supervisor 管理进程, 打开 0.0.0.0:9001 账号user 密码321 进入进程管理界面,管理uwsgi,webssh,celery,Inception 等启动关闭。Log in to the background, set the timing to get the host diagram, and set up the data center and user group.
Set the task of getting host information at a fixed time. First create the time frequency of execution, and then create the task. After creation, observe whether the queue task is executed successfully. If unsuccessful, restart all celery services in supervisor.
Development Settin
If you want to open the pycharm under windows, first pip install the module, ansbile cannot be installed on the windows, ignore it. Then comment on the following code. Comment xadmin
Asset/views.py from tasks.ansible_2420.runner import AdHocRunner, CommandRunner from tasks.ansible_2420.inventory import BaseInventory tasks/views.py from tasks.ansible_2420.runner import AdHocRunner, CommandRunner from tasks.ansible_2420.inventory import BaseInventory release/views.py from tasks.ansible_2420.runner import AdHocRunner from tasks.ansible_2420.inventory import BaseInventory production environment
If you want to deploy and launch in a production environment, use nginx to handle it. You can refer to http://hequan.blog.51cto.com/5701886/1982769. Please delete the part about uwsgi in supervisor.conf and control the startup and shutdown of UWSGI in the following ways.
Uwsgi-- ini / opt/autoops/script/uwsgi.ini # Startup uwsgi configuration can also write this command to the boot file uwsgi-- stop / opt/autoops/script/uwsgi.pid # close uwsgi uwsgi-- reload / opt/autoops/script/uwsgi.pid # reload
The nginx configuration file is modified as follows. This method also starts uwsgi.
Screenshot of root / opt/autoops; location / {include uwsgi_params; uwsgi_connect_timeout 30; uwsgi_pass unix:/opt/autoops/script/uwsgi.sock;} location / static/ {alias / opt/autoops/static/; index index.html index.htm;}
Contributor 1.0
He Quan
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.