opsmanage 自动化运维管理平台
关闭防火墙、selinux
更换阿里云 yum源
依赖环境
yum install -y epel-release
yum install vim net-tools nmon htop rsync tree ntp iftop wget clamav -y
安装easy_install
cd /tools
[root@jason tools]# wget --no-check-certificate https://pypi.python.org/packages/f7/94/eee867605a99ac113c4108534ad7c292ed48bf1d06dfe7b63daa51e49987/setuptools-28.0.0.tar.gz#md5=9b23df90e1510c7353a5cf07873dcd22
[root@jason tools]# tar -xzvf setuptools-28.0.0.tar.gz
[root@jason tools]#cd setuptools-28.0.0
[root@jason tools]#python setup.py install
安装pip
# wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz -O pip-1.5.5.tar.gz
# tar -xzvf pip-1.5.5.tar.gz
# cd pip-1.5.5/
# python setup.py install
# pip install -U pip
安装模块
依赖环境
yum install -y mysql-devel python-devel
# cd /mnt/
# git clone https://github.com/welliamcao/OpsManage.git
# cd /mnt/OpsManage/
#vim requirements.txt
将Django版本改为1.8.17
# pip install -r requirements.txt
pip install paramiko
安装Redis
# wget http://download.redis.io/releases/redis-3.2.8.tar.gz
# tar -xzvf redis-3.2.8.tar.gz
# cd redis-3.2.8
# make
# make install
# vim redis.conf
修改以下配置
daemonize yes #128行
loglevel warning #158行
logfile "/var/log/redis.log" #163行
bind 你的服务器ip地址 #61行
例如: bind 127.0.0.1 192.168.88.201
# cd ../
# mv redis-3.2.8 /usr/local/redis
# /usr/local/redis/src/redis-server /usr/local/redis/redis.conf
开机自启
将/usr/local/redis/src/redis-server /usr/local/redis/redis.conf加入到/etc/rc.d/rc.local
安装mysql
配置文件添加
[root@jason ~]# cat /etc/my.cnf |grep -Ev '^%|^$'
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
character_set_server = utf8
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' ##添加
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
创建数据库opsmanage ,并赋予全部权限
# mysql -uroot -p
mysql> create database opsmanage DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> grant all privileges on opsmanage.* to root@'%' identified by 'jason_zhang';
mysql> FLUSH PRIVILEGES;
配置OpsManage
[root@jason ~]# cd /mnt/OpsManage/
[root@jason OpsManage]# cd OpsManage/
[root@jason OpsManage]# cat settings.py |grep -Ev '^%|^$'
#!/usr/bin/env python
# _#_ coding:utf- _*_
"""
Django settings for OpsManage project.
Generated by 'django-admin startproject' using Django 1.9..
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import djcelery
from celery import platforms
from kombu import Queue,Exchange
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
''' celery config '''
djcelery.setup_loader()
BROKER_URL = 'redis://192.168.199.224:6379/4' ##redis的IP、端口和库
CELERY_RESULT_BACKEND = 'djcelery.backends.database.DatabaseBackend'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER='pickle'
CELERY_ACCEPT_CONTENT = ['pickle','json']
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
CELERY_TASK_RESULT_EXPIRES = * *
CELERYD_MAX_TASKS_PER_CHILD =
CELERY_TRACK_STARTED = True
CELERY_ENABLE_UTC = False
CELERY_TIMEZONE='Asia/Shanghai'
platforms.C_FORCE_ROOT = True
#celery route config
CELERY_IMPORTS = ("OpsManage.tasks.assets","OpsManage.tasks.ansible",
"OpsManage.tasks.cron","OpsManage.tasks.deploy",
"OpsManage.tasks.sql","OpsManage.tasks.sched")
CELERY_QUEUES = (
Queue('default',Exchange('default'),routing_key='default'),
Queue('ansible',Exchange('ansible'),routing_key='ansible'),
)
CELERY_ROUTES = {
'OpsManage.tasks.sql.*':{'queue':'default','routing_key':'default'},
'OpsManage.tasks.assets.*':{'queue':'default','routing_key':'default'},
'OpsManage.tasks.cron.*':{'queue':'default','routing_key':'default'},
'OpsManage.tasks.sched.*':{'queue':'default','routing_key':'default'},
'OpsManage.tasks.ansible.AnsibleScripts':{'queue':'ansible','routing_key':'ansible'},
'OpsManage.tasks.ansible.AnsiblePlayBook':{'queue':'ansible','routing_key':'ansible'},
}
CELERY_DEFAULT_QUEUE = 'default'
CELERY_DEFAULT_EXCHANGE_TYPE = 'topic'
CELERY_DEFAULT_ROUTING_KEY = 'default'
REDSI_KWARGS_LPUSH = {"host":'192.168.199.224','port':6379,'db':4}
REDSI_LPUSH_POOL = None
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'kd8f&jx1h^1m-uldfdo3d#10d9mbc-ijjz!tozusy@aw#h+875'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Channels settings
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer", # use redis backend
"CONFIG": {
"hosts": [("localhost", )],
"channel_capacity": {
"http.request": ,
"websocket.send*": ,
},
"capacity": ,
},
"ROUTING": "OpsManage.routing.channel_routing", # load routing from our routing.py file
},
}
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'OpsManage',
'rest_framework',
'djcelery',
'channels',
'storages',
'wiki',
'orders',
'api',
'filemanage',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
# 'django.middleware.csrf.CsrfResponseMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
),
}
ROOT_URLCONF = 'OpsManage.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ["/mnt/OpsManage/OpsManage/static/",'/mnt/OpsManage/OpsManage/templates/'], ##根据下载的opsmanage存放位置
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'OpsManage.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE':'django.db.backends.mysql',
'NAME':'opsmanage',
'USER':'root',
'PASSWORD':'jason_zhang',
'HOST':'192.168.199.224'
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Shanghai'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
'/mnt/OpsManage/OpsManage/static/',
)
MEDIA_ROOT = os.path.join(BASE_DIR,'upload/')
MEDIA_URL = '/upload/'
SFTP_CONF = {
'port':,
'username':'root',
'password':'welliam',
'timeout':
}
WORKSPACES = '/var/lib/opsmanage/workspaces/'
LOGIN_URL = '/login'
生成数据表与管理员账户
yum remove python-gssapi.x86_64 不然会django、Paramiko报错
# cd /mnt/OpsManage/
# python manage.py makemigrations OpsManage
# python manage.py makemigrations wiki
# python manage.py makemigrations orders
# python manage.py makemigrations filemanage
# python manage.py migrate
# python manage.py createsuperuser
启动部署平台
# cd /mnt/OpsManage/
# python manage.py runserver 0.0.0.0:8000
注意,启动后,会占用当前终端,需要调整时开启新终端登录
http://192.168.199.224:8000
配置Celery异步任务系统
celery-分布式异步任务调度系统
了解:https://blog.csdn.net/bojie5744/article/details/52965668
# echo_supervisord_conf > /etc/supervisord.conf
# export PYTHONOPTIMIZE=1
# vim /etc/supervisord.conf
在最后面加上
[program:celery-worker-default]
command=/usr/bin/python manage.py celery worker --loglevel=info -E -Q default
directory=/mnt/OpsManage
stdout_logfile=/var/log/celery-worker-default.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
numprocs=1 [program:celery-worker-ansible]
command=/usr/bin/python manage.py celery worker --loglevel=info -E -Q ansible
directory=/mnt/OpsManage
stdout_logfile=/var/log/celery-worker-ansible.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
numprocs=1 [program:celery-beat]
command=/usr/bin/python manage.py celery beat
directory=/mnt/OpsManage
stdout_logfile=/var/log/celery-beat.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
numprocs=1 [program:celery-cam]
command=/usr/bin/python manage.py celerycam
directory=/mnt/OpsManage
stdout_logfile=/var/log/celery-celerycam.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
numprocs=1
启动celery
# /usr/bin/supervisord -c /etc/supervisord.conf #注意centos7上路径
# supervisorctl status #要检查是否都是running状态
SQL审核
自行安装Inception与SQLadvisor,SQLadvisor可执行文件请放在OpsManage服务器/usr/bin/sqladvisor路径 (不支持阿里云RDS)
详看inception+archery SQL审核平台 https://www.cnblogs.com/xiaoyou2018/p/9936585.html
参考:http://blog.51cto.com/11555417/2155028
https://github.com/welliamcao/OpsManage
https://www.oschina.net/p/opsmanage
Python 进程管理工具 Supervisor 使用教程
https://www.restran.net/2015/10/04/supervisord-tutorial/
opsmanage 自动化运维管理平台的更多相关文章
- Linux运维之Ansible自动化运维管理工具
Ansible简介:Ansible是一个简单高效的自动化运维管理工具,用Python开发,能大批量管理N多台机器,可以并发的在多台机器上部署应用.安装软件.执行命令.配置和编排任务.后面会提到批量安装 ...
- django 实现linux运维管理平台
概述 使用django实现一个linux运维管理平台,可以实现注册登录,机器管理 ,服务器批量操作,服务器性能监控. 详细 代码下载:http://www.demodashi.com/demo/112 ...
- Ansible 自动化运维管理工具
Ansible 自动化运维管理工具 1.Ansible概述 2.Ansible部署 3.Ansible模块 1.Ansible概述: Ansible是一个基于Python开发的配置管理和应用部署工具, ...
- Ansible-Tower自动化运维管理环境 - 安装破解记录
公司中实现运维自动化的架构中主要用到ansible,ansible脚本在部署服务器指令行中显得不太直观.Ansible-Tower(之前叫做awx)是将ansible的指令界面化,简明直观,简单易用. ...
- 安装配置OSA运维管理平台
1.下载完整包V1.0.2wget http://www.osapub.com/download/OSA_BETA_V1.0.2.tar.gzV1.0.5wget http://www.osapub. ...
- ansible自动化运维管理工具
1.Ansible介绍 1)Ansible:Ansible的核心程序 2)Host Inventory:(默认路径:/etc/ansible/hosts)记录了每一个由Ansible管理的主机信息,信 ...
- MySQL 运维管理平台
github: https://github.com/XiaohaoYu/mysql_platform
- 国产安全自主可控IT智能运维管理解决方案
新一轮科技革命和产业变革席卷全球,大数据.云计算.物联网.人工智能.区块链等新技术不断涌现,数字经济正深刻地改变着人类的生产和生活方式,作为经济增长新动能的作用日益凸显.伴随增长的,还有网络中不断涌现 ...
- 解决连锁零售行业IT运维管理四大困境
解决连锁零售行业IT运维管理四大困境 中国近年来,连锁零售行业进入了行业的发展高潮,迅速崛起一批大型连锁业态.而随着IT技术的不断进步,连锁零售企业已经步入IT信息化快速发展的重要阶段:在面对激烈 ...
随机推荐
- linux系统安全更新
um --security upgrade 一.参考文档: https://blog.csdn.net/ubuntu64fan/article/details/80927212 二.Linux主机定 ...
- centos6 安装 docker 问题
参考:https://www.cnblogs.com/cs294639693/p/10164258.html 第一步:删除 参考:https://www.cnblogs.com/liuyanshen ...
- 利用STM32CubeMX之SPI
现在我们继续使用STM32CubeMX来生成SPI工程.我们的硬件平台还是我们熟悉的STM32F103C8开发板. 设置时钟树中的配置 现在打开SPI的设置 如果想修改管脚的名字可以红色框中进行修改, ...
- 选择、操作web元素
11月1日 什么是web元素 Selenium自动化主要就是:选择界面元素,操作界面元素(输入操作:点击.输入文字.拖拽等,输出操作:获取元素的各种属性),根据界面上获取的数据进行分析和处理 选择元素 ...
- jquery 全选操作
$(function(){ $("#checkedAll").change(function(){ if(this.checked){ $(".checkSingle&q ...
- ORM查询api
下面的方法都是对查询的结果进行出理:比如objects.filter.values()... 1)values(*field):返回一个可迭代的字典序列<QuerySet: [{name='小王 ...
- Python的几种主流框架
参考:https://www.cnblogs.com/linkenpark/p/5881586.html
- C#利用CDO.Message发送邮件
如何引用CDO.Message? cod.message的引用位置: C:\Windows\System32\cdosys.dll CDO.Message objMail = new CDO.Mess ...
- Spark读取配置(转)
转自:https://github.com/keepsimplefocus/spark-sourcecodes-analysis/blob/master/markdowns/Spark%E8%AF%B ...
- 尚硅谷springboot学习6-eclipse创建springboot项目的三种方法(转)
方法一 安装STS插件 安装插件导向窗口完成后,在eclipse右下角将会出现安装插件的进度,等插件安装完成后重启eclipse生效 新建spring boot项目 项目启动 方法二 1.创建Mave ...