Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增zabbix #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified accounts/__init__.py
100644 → 100755
Empty file.
Binary file added accounts/__init__.pyc
Binary file not shown.
Empty file modified accounts/admin.py
100644 → 100755
Empty file.
Binary file added accounts/admin.pyc
Binary file not shown.
Empty file modified accounts/apps.py
100644 → 100755
Empty file.
Empty file modified accounts/forms.py
100644 → 100755
Empty file.
Binary file added accounts/forms.pyc
Binary file not shown.
Empty file modified accounts/migrations/0001_initial.py
100644 → 100755
Empty file.
Binary file added accounts/migrations/0001_initial.pyc
Binary file not shown.
Empty file modified accounts/migrations/__init__.py
100644 → 100755
Empty file.
Binary file added accounts/migrations/__init__.pyc
Binary file not shown.
Empty file modified accounts/models.py
100644 → 100755
Empty file.
Binary file added accounts/models.pyc
Binary file not shown.
Empty file modified accounts/permission.py
100644 → 100755
Empty file.
Binary file added accounts/permission.pyc
Binary file not shown.
Empty file modified accounts/role.py
100644 → 100755
Empty file.
Binary file added accounts/role.pyc
Binary file not shown.
Empty file modified accounts/tests.py
100644 → 100755
Empty file.
Empty file modified accounts/urls.py
100644 → 100755
Empty file.
Binary file added accounts/urls.pyc
Binary file not shown.
Empty file modified accounts/user.py
100644 → 100755
Empty file.
Binary file added accounts/user.pyc
Binary file not shown.
27 changes: 21 additions & 6 deletions adminset.conf
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ engine = mysql
host = 127.0.0.1
port = 3306
user = root
password =
password = 123456
database = adminset
charset=utf8

[token]
token = HPcWR7l4NJNJ
ssh_pwd = root
ssh_pwd = HPcWR7l4NJNJ

[log]
log_path = /var/opt/adminset/logs
Expand All @@ -23,17 +24,31 @@ log_level = info
[mongodb]
mongodb_ip = 127.0.0.1
mongodb_port = 27017
mongodb_user =
mongodb_pwd =
mongodb_user =
mongodb_pwd =
collection = sys_info

[webssh]
domain = adminset.cn
domain = meidai.f3322.net

[redis]
redis_host = 127.0.0.1
redis_port = 6379
redis_password =
redis_password =
redis_db = 0

[zabbix]
url = http://zabbix.meidai.f3322.net/zabbix
user = Admin
password = zabbix
login_url = http://zabbix.meidai.f3322.net/zabbix/index.php
graph = http://zabbix.meidai.f3322.net/zabbix/chart2.php

[zbmysql]
host=10.10.10.234
port=3306
user=zabbix
passwd=zabbix
db=zabbix
charset=utf8

Empty file modified adminset/__init__.py
100644 → 100755
Empty file.
Binary file added adminset/__init__.pyc
Binary file not shown.
Empty file modified adminset/celery.py
100644 → 100755
Empty file.
Binary file added adminset/celery.pyc
Binary file not shown.
Empty file modified adminset/ldap.py
100644 → 100755
Empty file.
36 changes: 36 additions & 0 deletions adminset/middleware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:lvhaidong
# datetime:2018/4/19 00:00
# software: PyCharm

import time

import logging
from lib.log import log
from config.views import get_dir

level = get_dir("log_level")
log_path = get_dir("log_path")
log("middleware.log", level, "/Users/lvhaidong/Desktop/main/logs")


class AccessMiddleware(object):
def process_request(self, request):
meta = request.META
print "[%s] PATH_INFO=%s, REMOTE_ADDR=%s, HTTP_USER_AGENT=%s" \
% (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
meta['PATH_INFO'], meta['REMOTE_ADDR'], meta['HTTP_USER_AGENT'])
logging.debug("[%s] PATH_INFO=%s, REMOTE_ADDR=%s, HTTP_USER_AGENT=%s" \
% (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
meta['PATH_INFO'], meta['REMOTE_ADDR'], meta['HTTP_USER_AGENT']))
logging.info("[%s] PATH_INFO=%s, REMOTE_ADDR=%s, HTTP_USER_AGENT=%s" \
% (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
meta['PATH_INFO'], meta['REMOTE_ADDR'], meta['HTTP_USER_AGENT']))
logging.warning("[%s] PATH_INFO=%s, REMOTE_ADDR=%s, HTTP_USER_AGENT=%s" \
% (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
meta['PATH_INFO'], meta['REMOTE_ADDR'], meta['HTTP_USER_AGENT']))
return None

def process_response(self, request, response):
return response
Binary file added adminset/middleware.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions adminset/settings.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'monitor',
'appconf',
'delivery',
'zabbix',
'django_celery_results',
'django_celery_beat',
'django.contrib.admin',
Expand All @@ -60,6 +61,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'jsonrpc',
]

MIDDLEWARE_CLASSES = [
Expand All @@ -71,6 +73,7 @@
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# 'adminset.middleware.AccessMiddleware',
]

ROOT_URLCONF = 'adminset.urls'
Expand Down
Binary file added adminset/settings.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions adminset/urls.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
import views

urlpatterns = [
Expand All @@ -14,4 +13,6 @@
url(r'^accounts/', include('accounts.urls')),
url(r'^appconf/', include('appconf.urls')),
url(r'^delivery/', include('delivery.urls')),
]
url(r'^zabbix/', include('zabbix.urls')),
]

Binary file added adminset/urls.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion adminset/views.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import json


from django.shortcuts import redirect


def index(request):
return redirect('/navi/')
return redirect('/navi/')
Binary file added adminset/views.pyc
Binary file not shown.
Empty file modified adminset/wsgi.py
100644 → 100755
Empty file.
Binary file added adminset/wsgi.pyc
Binary file not shown.
Empty file modified appconf/__init__.py
100644 → 100755
Empty file.
Binary file added appconf/__init__.pyc
Binary file not shown.
Empty file modified appconf/appowner.py
100644 → 100755
Empty file.
Binary file added appconf/appowner.pyc
Binary file not shown.
Empty file modified appconf/apps.py
100644 → 100755
Empty file.
Empty file modified appconf/authinfo.py
100644 → 100755
Empty file.
Binary file added appconf/authinfo.pyc
Binary file not shown.
Empty file modified appconf/forms.py
100644 → 100755
Empty file.
Binary file added appconf/forms.pyc
Binary file not shown.
Empty file modified appconf/migrations/0001_initial.py
100644 → 100755
Empty file.
Binary file added appconf/migrations/0001_initial.pyc
Binary file not shown.
Empty file modified appconf/migrations/__init__.py
100644 → 100755
Empty file.
Binary file added appconf/migrations/__init__.pyc
Binary file not shown.
Empty file modified appconf/models.py
100644 → 100755
Empty file.
Binary file added appconf/models.pyc
Binary file not shown.
Empty file modified appconf/product.py
100644 → 100755
Empty file.
Binary file added appconf/product.pyc
Binary file not shown.
Empty file modified appconf/project.py
100644 → 100755
Empty file.
Binary file added appconf/project.pyc
Binary file not shown.
Empty file modified appconf/tests.py
100644 → 100755
Empty file.
Empty file modified appconf/urls.py
100644 → 100755
Empty file.
Binary file added appconf/urls.pyc
Binary file not shown.
Empty file modified appconf/views.py
100644 → 100755
Empty file.
Empty file modified cmdb/__init__.py
100644 → 100755
Empty file.
Binary file added cmdb/__init__.pyc
Binary file not shown.
Empty file modified cmdb/admin.py
100644 → 100755
Empty file.
Binary file added cmdb/admin.pyc
Binary file not shown.
Empty file modified cmdb/api.py
100644 → 100755
Empty file.
Binary file added cmdb/api.pyc
Binary file not shown.
Empty file modified cmdb/apps.py
100644 → 100755
Empty file.
Empty file modified cmdb/asset.py
100644 → 100755
Empty file.
Binary file added cmdb/asset.pyc
Binary file not shown.
Empty file modified cmdb/cabinet.py
100644 → 100755
Empty file.
Binary file added cmdb/cabinet.pyc
Binary file not shown.
Empty file modified cmdb/forms.py
100644 → 100755
Empty file.
Binary file added cmdb/forms.pyc
Binary file not shown.
Empty file modified cmdb/group.py
100644 → 100755
Empty file.
Binary file added cmdb/group.pyc
Binary file not shown.
Empty file modified cmdb/idc.py
100644 → 100755
Empty file.
Binary file added cmdb/idc.pyc
Binary file not shown.
Empty file modified cmdb/migrations/0001_initial.py
100644 → 100755
Empty file.
Binary file added cmdb/migrations/0001_initial.pyc
Binary file not shown.
Empty file modified cmdb/migrations/__init__.py
100644 → 100755
Empty file.
Binary file added cmdb/migrations/__init__.pyc
Binary file not shown.
Empty file modified cmdb/models.py
100644 → 100755
Empty file.
Binary file added cmdb/models.pyc
Binary file not shown.
Empty file modified cmdb/templatetags/__init__.py
100644 → 100755
Empty file.
Binary file added cmdb/templatetags/__init__.pyc
Binary file not shown.
Empty file modified cmdb/templatetags/mytags.py
100644 → 100755
Empty file.
Binary file added cmdb/templatetags/mytags.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion cmdb/urls.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from django.conf.urls import url
from cmdb import api, idc, asset, group, cabinet


Expand Down
Binary file added cmdb/urls.pyc
Binary file not shown.
Empty file modified config/__init__.py
100644 → 100755
Empty file.
Binary file added config/__init__.pyc
Binary file not shown.
Empty file modified config/admin.py
100644 → 100755
Empty file.
Binary file added config/admin.pyc
Binary file not shown.
Empty file modified config/apps.py
100644 → 100755
Empty file.
Empty file modified config/migrations/__init__.py
100644 → 100755
Empty file.
Binary file added config/migrations/__init__.pyc
Binary file not shown.
Empty file modified config/models.py
100644 → 100755
Empty file.
Binary file added config/models.pyc
Binary file not shown.
Empty file modified config/tests.py
100644 → 100755
Empty file.
Empty file modified config/urls.py
100644 → 100755
Empty file.
Binary file added config/urls.pyc
Binary file not shown.
5 changes: 5 additions & 0 deletions config/views.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def get_dir(args):
redis_port = config.get('redis', 'redis_port')
redis_password = config.get('redis', 'redis_password')
redis_db = config.get('redis', 'redis_db')
zabbix_url = config.get('zabbix', 'url')
zabbix_user = config.get('zabbix', 'user')
zabbix_passwd = config.get('zabbix', 'password')
login_url = config.get('zabbix', 'login_url')
graph = config.get('zabbix', 'graph')
# 根据传入参数返回变量以获取配置,返回变量名与参数名相同
if args:
return vars()[args]
Expand Down
Binary file added config/views.pyc
Binary file not shown.
Empty file modified delivery/__init__.py
100644 → 100755
Empty file.
Binary file added delivery/__init__.pyc
Binary file not shown.
Empty file modified delivery/admin.py
100644 → 100755
Empty file.
Binary file added delivery/admin.pyc
Binary file not shown.
Empty file modified delivery/apps.py
100644 → 100755
Empty file.
Empty file modified delivery/delivery.py
100644 → 100755
Empty file.
Binary file added delivery/delivery.pyc
Binary file not shown.
Empty file modified delivery/forms.py
100644 → 100755
Empty file.
Binary file added delivery/forms.pyc
Binary file not shown.
Empty file modified delivery/migrations/0001_initial.py
100644 → 100755
Empty file.
Binary file added delivery/migrations/0001_initial.pyc
Binary file not shown.
Empty file modified delivery/migrations/__init__.py
100644 → 100755
Empty file.
Binary file added delivery/migrations/__init__.pyc
Binary file not shown.
Empty file modified delivery/models.py
100644 → 100755
Empty file.
Binary file added delivery/models.pyc
Binary file not shown.
Empty file modified delivery/tasks.py
100644 → 100755
Empty file.
Binary file added delivery/tasks.pyc
Binary file not shown.
Empty file modified delivery/urls.py
100644 → 100755
Empty file.
Binary file added delivery/urls.pyc
Binary file not shown.
Empty file modified delivery/views.py
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions docs/Manual.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
建议adminset放在网管区中,并且开启防火墙。
django的settings中开启了DEBUG,在生产中需要关闭并指定自己的域名。
adminset设计初衷为超级管理员工具集成平台,所以后台权限都使用超管权限,如果生产环境中不符合安全要求,需要自定义各后台权限调用。

# 开发者交流
QQ群:536962005


# 新增zabbix的模板绑定与解除,主机的创建并且添加到主机组,一个监控按钮
在需要新增一个zabbix_host表,并且在adminset.conf中修改对应的zabbix,zbmysql 既可
Empty file modified gunicorn_conf.py
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion install/client/adminset_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import psutil, schedule, requests
from subprocess import Popen, PIPE
import logging
AGENT_VERSION = "0.23"
AGENT_VERSION = "0.21"
token = 'HPcWR7l4NJNJ'
server_ip = '192.168.47.130'

Expand Down
Empty file modified install/client/adminsetd.service
100644 → 100755
Empty file.
13 changes: 4 additions & 9 deletions install/client/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,22 @@ EOF

echo "####install pip packages####"
mkdir -p $work_dir

pip install -U pip==9.0.3
pip install virtualenv==15.2.0
source /etc/profile

echo "####config adminset agent####"
if (echo $os|grep centos) || (echo $os|grep 'Red Hat')
then
if (rpm -ql python|grep 2.6)
then
pip install -U pip==9.0.3
pip install virtualenv==14.0.0
pip install setuptools==28.5.0
pip install setuptools==0.6rc11
scp $cur_dir/adminset_agent.py $work_dir
scp $cur_dir/adminsetd /etc/init.d/
dos2unix $work_dir/adminset_agent.py
dos2unix /etc/init.d/adminsetd
chmod +x /etc/init.d/adminsetd
else
pip install -U pip==9.0.3
pip install virtualenv==15.2.0
scp $cur_dir/adminset_agent.py $work_dir
scp $cur_dir/adminsetd.service /usr/lib/systemd/system/
dos2unix $work_dir/adminset_agent.py
Expand All @@ -62,8 +59,6 @@ then
chkconfig adminsetd on
elif (echo $os|grep Ubuntu)
then
pip install -U pip==9.0.3
pip install virtualenv==15.2.0
scp $cur_dir/adminset_agent.py $work_dir
scp $cur_dir/adminsetd.service /etc/systemd/system/
fromdos $work_dir/adminset_agent.py
Expand All @@ -77,7 +72,7 @@ fi
cd $work_dir
virtualenv venv
source $work_dir/venv/bin/activate
#pip install python-daemon==2.1.2
pip install python-daemon==2.1.2
pip install requests==2.11.1
pip install psutil==5.2.2
pip install schedule==0.4.3
Expand Down
Empty file modified install/server/adminset.service
100644 → 100755
Empty file.
Empty file modified install/server/ansible/ansible.cfg
100644 → 100755
Empty file.
Empty file modified install/server/celery/beat.conf
100644 → 100755
Empty file.
Empty file modified install/server/celery/beat.service
100644 → 100755
Empty file.
Empty file modified install/server/celery/celery.service
100644 → 100755
Empty file.
Empty file modified install/server/celery/start_celery.sh
100644 → 100755
Empty file.
Empty file modified install/server/nginx/adminset.conf
100644 → 100755
Empty file.
Empty file modified install/server/nginx/adminset.conf.https
100644 → 100755
Empty file.
Empty file modified install/server/nginx/nginx.conf
100644 → 100755
Empty file.
Empty file modified install/server/nginx/nginx.crt
100644 → 100755
Empty file.
Empty file modified install/server/nginx/nginx.key
100644 → 100755
Empty file.
Empty file modified install/server/ssh/config
100644 → 100755
Empty file.
Empty file modified install/server/webssh/webssh.service
100644 → 100755
Empty file.
Empty file modified lib/__init__.py
100644 → 100755
Empty file.
Binary file added lib/__init__.pyc
Binary file not shown.
Empty file modified lib/backup.py
100644 → 100755
Empty file.
18 changes: 18 additions & 0 deletions lib/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:lvhaidong
# datetime:2018/4/19 13:15
# software: PyCharm


class ResponseCode(object):
"""返回代码"""

SUCCEED = 1 # 成功
FAIL = 0
ERROR = -1 # 失败


class ResponseMessage(object):
"""响应信息"""
NOT_LOGIN = "Not Login!"
Empty file modified lib/common.py
100644 → 100755
Empty file.
Binary file added lib/common.pyc
Binary file not shown.
Loading