├── alert ├── __init__.py ├── migrations │ └── __init__.py ├── tests.py ├── admin.py ├── apps.py ├── models.py └── urls.py ├── asset ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0020_delete_disquecluster.py │ ├── 0016_delete_gotemplaterevision.py │ ├── 0022_goservices_level.py │ ├── 0008_auto_20161220_1431.py │ ├── 0021_goservices_ports.py │ ├── 0012_auto_20170401_2134.py │ ├── 0019_auto_20180307_1149.py │ ├── 0002_auto_20160713_1448.py │ ├── 0017_asset_wan_ip.py │ ├── 0003_auto_20160713_1453.py │ ├── 0011_auto_20170313_1420.py │ ├── 0018_disquecluster.py │ ├── 0015_auto_20170905_1604.py │ ├── 0004_auto_20160713_1517.py │ ├── 0014_gotemplaterevision.py │ ├── 0005_gobuild.py │ ├── 0010_userprofile.py │ ├── 0002_auto_20180613_1342.py │ ├── 0006_gostatus.py │ ├── 0013_auto_20170704_1645.py │ ├── 0007_crontab_svn.py │ └── 0009_gotemplate.py ├── tests.py ├── apps.py ├── urls.py └── admin.py ├── cache ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0002_auto_20160715_1046.py │ └── 0001_initial.py ├── tests.py ├── apps.py ├── admin.py ├── models.py ├── urls.py └── views.py ├── cmdb ├── __init__.py ├── migrations │ └── __init__.py ├── templatetags │ ├── __init__.py │ └── cmdbtags.py ├── tests.py ├── admin.py ├── models.py ├── apps.py ├── http.py └── views.py ├── disque ├── __init__.py ├── migrations │ ├── __init__.py │ └── 0001_initial.py ├── tests.py ├── apps.py ├── admin.py ├── models.py └── urls.py ├── kettle ├── __init__.py ├── migrations │ └── __init__.py ├── tests.py ├── admin.py ├── models.py ├── apps.py ├── urls.py ├── views.py └── utils.py ├── logs ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0002_publishlog.py │ └── 0001_initial.py ├── tests.py ├── apps.py ├── admin.py ├── views.py ├── models.py └── urls.py ├── users ├── __init__.py ├── migrations │ └── __init__.py ├── tests.py ├── admin.py ├── models.py ├── apps.py └── urls.py ├── web ├── __init__.py ├── migrations │ ├── __init__.py │ └── 0001_initial.py ├── admin.py ├── tests.py ├── apps.py ├── models.py └── views.py ├── www ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0002_weburl_ip.py │ └── 0003_groupname.py ├── tests.py ├── apps.py ├── admin.py ├── urls.py └── models.py ├── command_job ├── __init__.py ├── migrations │ └── __init__.py ├── tests.py ├── admin.py ├── apps.py ├── models.py └── urls.py ├── consul_kv ├── __init__.py ├── migrations │ └── __init__.py ├── admin.py ├── tests.py ├── apps.py ├── models.py └── urls.py ├── salt_api ├── __init__.py ├── migrations │ └── __init__.py ├── admin.py ├── tests.py ├── views.py ├── models.py ├── apps.py └── api.py ├── subversion ├── __init__.py ├── tests.py ├── apps.py ├── admin.py ├── models.py └── urls.py ├── winservices ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0002_auto_20160718_1358.py │ └── 0001_initial.py ├── tests.py ├── apps.py ├── admin.py ├── models.py ├── urls.py └── views.py ├── workflow ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0003_webinfo_type.py │ └── 0002_webinfo.py ├── tests.py ├── apps.py ├── admin.py └── urls.py ├── config_center ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0002_auto_20170729_1758.sql │ ├── 0003_auto_20170729_1804.sql │ ├── 0002_auto_20170729_1758.py │ ├── 0003_auto_20170729_1804.py │ ├── 0001_initial.sql │ └── 0001_initial.py ├── tests.py ├── apps.py ├── admin.py ├── urls.py ├── models.py └── views.py ├── project_crontab ├── __init__.py ├── migrations │ ├── __init__.py │ ├── 0002_auto_20180614_1813.py │ └── 0003_auto_20180614_1816.py ├── tests.py ├── admin.py ├── apps.py ├── urls.py ├── utils.py ├── models.py └── cron.py ├── .DS_Store ├── static ├── .DS_Store ├── img │ ├── .DS_Store │ └── logo.png ├── screen │ ├── 111.png │ ├── 112.png │ ├── 113.png │ ├── 114.png │ ├── 115.png │ ├── 116.png │ ├── 117.png │ ├── 118.png │ ├── 119.png │ ├── 120.png │ ├── 121.png │ └── .DS_Store ├── alert │ └── chosen-sprite.png ├── css │ ├── images │ │ ├── controls.png │ │ ├── loading.gif │ │ └── page_loading.gif │ ├── patterns │ │ ├── shattered.png │ │ ├── otis_redding.png │ │ ├── triangular.png │ │ ├── header-profile.png │ │ ├── congruent_pentagon.png │ │ ├── header-profile-skin-1.png │ │ ├── header-profile-skin-2.png │ │ └── header-profile-skin-3.png │ ├── plugins │ │ ├── iCheck │ │ │ ├── green.png │ │ │ ├── green@2x.png │ │ │ └── custom.css │ │ ├── images │ │ │ ├── sort.png │ │ │ ├── sort_asc.png │ │ │ ├── sort_desc.png │ │ │ ├── spritemap.png │ │ │ ├── spritemap@2x.png │ │ │ ├── sprite-skin-flat.png │ │ │ ├── sprite-skin-nice.png │ │ │ ├── sprite-skin-flat2.png │ │ │ ├── sprite-skin-simple.png │ │ │ └── bootstrap-colorpicker │ │ │ │ ├── hue.png │ │ │ │ ├── alpha.png │ │ │ │ ├── saturation.png │ │ │ │ ├── hue-horizontal.png │ │ │ │ └── alpha-horizontal.png │ │ └── chosen │ │ │ ├── chosen-sprite.png │ │ │ └── chosen-sprite@2x.png │ └── vaildator │ │ └── images │ │ ├── loading.gif │ │ ├── validator_simple.png │ │ └── validator_default.png ├── files │ └── excels │ │ └── asset.xlsx ├── js │ ├── layer │ │ └── skin │ │ │ └── default │ │ │ ├── icon.png │ │ │ ├── icon-ext.png │ │ │ ├── loading-0.gif │ │ │ ├── loading-1.gif │ │ │ └── loading-2.gif │ ├── validator │ │ └── images │ │ │ ├── loading.gif │ │ │ ├── validator_default.png │ │ │ └── validator_simple.png │ ├── custom │ │ ├── bar.js │ │ └── project.js │ ├── demo │ │ └── peity-demo.js │ ├── highcharts │ │ ├── modules │ │ │ ├── no-data-to-display.js │ │ │ ├── funnel.js │ │ │ └── solid-gauge.js │ │ └── themes │ │ │ ├── grid-light.js │ │ │ ├── skies.js │ │ │ ├── sand-signika.js │ │ │ └── grid.js │ └── wssh.js ├── font-awesome │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ └── fontawesome-webfont.woff │ ├── less │ │ ├── fixed-width.less │ │ ├── bordered-pulled.less │ │ ├── larger.less │ │ ├── core.less │ │ ├── list.less │ │ ├── font-awesome.less │ │ ├── stacked.less │ │ ├── rotated-flipped.less │ │ ├── spinning.less │ │ ├── path.less │ │ └── mixins.less │ └── scss │ │ ├── _fixed-width.scss │ │ ├── _bordered-pulled.scss │ │ ├── _larger.scss │ │ ├── _core.scss │ │ ├── _list.scss │ │ ├── font-awesome.scss │ │ ├── _stacked.scss │ │ ├── _spinning.scss │ │ ├── _path.scss │ │ ├── _rotated-flipped.scss │ │ └── _mixins.scss └── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── mico ├── __init__.py ├── wsgi.py ├── celery.py └── urls.py ├── .gitattributes ├── templates ├── footer.html ├── getdata.html ├── head_script.html ├── nav_cat_bar.html ├── link_css.html ├── nav_bar_header.html ├── base.html ├── wwwGroup.html ├── 500.html ├── 404.html ├── restartMautic.html ├── getText.html ├── foot_script.html ├── commandIndex.html ├── kettleIndex.html ├── error.html ├── login.html ├── nav_li_profile.html ├── test.html ├── wwwList.html ├── winservices.html ├── goConf.html ├── go_template.html ├── gostatus.html └── cronjob_list.html ├── uwsgi_socket.xml ├── manage.py ├── wsgi.py ├── cmdb_api.conf ├── django.conf ├── cmdb_api_supervisor.conf ├── django_celery.conf ├── install.sh ├── cmdb_cronjob_api_supervisor.conf ├── cronjob_api.py ├── requirements.txt ├── README.md └── .gitignore /alert/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /asset/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cache/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmdb/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /disque/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /kettle/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /users/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /www/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /command_job/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /consul_kv/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /salt_api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /subversion/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /winservices/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /workflow/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /alert/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /asset/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cache/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmdb/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config_center/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project_crontab/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /users/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /www/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmdb/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /consul_kv/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /disque/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /kettle/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /salt_api/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /workflow/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /command_job/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config_center/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project_crontab/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /winservices/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/.DS_Store -------------------------------------------------------------------------------- /static/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/.DS_Store -------------------------------------------------------------------------------- /alert/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /asset/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /cache/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /cmdb/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /kettle/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /logs/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /static/img/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/img/.DS_Store -------------------------------------------------------------------------------- /static/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/img/logo.png -------------------------------------------------------------------------------- /static/screen/111.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/111.png -------------------------------------------------------------------------------- /static/screen/112.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/112.png -------------------------------------------------------------------------------- /static/screen/113.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/113.png -------------------------------------------------------------------------------- /static/screen/114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/114.png -------------------------------------------------------------------------------- /static/screen/115.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/115.png -------------------------------------------------------------------------------- /static/screen/116.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/116.png -------------------------------------------------------------------------------- /static/screen/117.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/117.png -------------------------------------------------------------------------------- /static/screen/118.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/118.png -------------------------------------------------------------------------------- /static/screen/119.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/119.png -------------------------------------------------------------------------------- /static/screen/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/120.png -------------------------------------------------------------------------------- /static/screen/121.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/121.png -------------------------------------------------------------------------------- /users/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /web/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /web/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /www/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /alert/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /command_job/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /consul_kv/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /consul_kv/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /kettle/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /salt_api/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /salt_api/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /salt_api/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /static/screen/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/screen/.DS_Store -------------------------------------------------------------------------------- /subversion/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /users/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /winservices/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /workflow/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /command_job/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /config_center/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /project_crontab/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /mico/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from .celery import app as celery_app -------------------------------------------------------------------------------- /project_crontab/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /cmdb/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /static/alert/chosen-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/alert/chosen-sprite.png -------------------------------------------------------------------------------- /static/css/images/controls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/images/controls.png -------------------------------------------------------------------------------- /static/css/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/images/loading.gif -------------------------------------------------------------------------------- /static/files/excels/asset.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/files/excels/asset.xlsx -------------------------------------------------------------------------------- /static/css/patterns/shattered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/patterns/shattered.png -------------------------------------------------------------------------------- /alert/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AlertConfig(AppConfig): 5 | name = 'alert' 6 | -------------------------------------------------------------------------------- /static/css/images/page_loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/images/page_loading.gif -------------------------------------------------------------------------------- /static/css/patterns/otis_redding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/patterns/otis_redding.png -------------------------------------------------------------------------------- /static/css/patterns/triangular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/patterns/triangular.png -------------------------------------------------------------------------------- /static/css/plugins/iCheck/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/iCheck/green.png -------------------------------------------------------------------------------- /static/css/plugins/images/sort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/sort.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=python 2 | *.css linguist-language=python 3 | *.html linguist-language=python 4 | -------------------------------------------------------------------------------- /static/css/patterns/header-profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/patterns/header-profile.png -------------------------------------------------------------------------------- /static/css/plugins/iCheck/green@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/iCheck/green@2x.png -------------------------------------------------------------------------------- /static/css/plugins/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/sort_asc.png -------------------------------------------------------------------------------- /static/js/layer/skin/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/js/layer/skin/default/icon.png -------------------------------------------------------------------------------- /static/js/validator/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/js/validator/images/loading.gif -------------------------------------------------------------------------------- /command_job/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CommandConfig(AppConfig): 5 | name = 'command' 6 | -------------------------------------------------------------------------------- /consul_kv/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CommandConfig(AppConfig): 5 | name = 'consul_kv' 6 | -------------------------------------------------------------------------------- /static/css/plugins/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/sort_desc.png -------------------------------------------------------------------------------- /static/css/plugins/images/spritemap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/spritemap.png -------------------------------------------------------------------------------- /static/css/vaildator/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/vaildator/images/loading.gif -------------------------------------------------------------------------------- /static/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /static/js/layer/skin/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/js/layer/skin/default/icon-ext.png -------------------------------------------------------------------------------- /cmdb/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | -------------------------------------------------------------------------------- /static/css/patterns/congruent_pentagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/patterns/congruent_pentagon.png -------------------------------------------------------------------------------- /static/css/plugins/chosen/chosen-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/chosen/chosen-sprite.png -------------------------------------------------------------------------------- /static/css/plugins/images/spritemap@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/spritemap@2x.png -------------------------------------------------------------------------------- /static/js/layer/skin/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/js/layer/skin/default/loading-0.gif -------------------------------------------------------------------------------- /static/js/layer/skin/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/js/layer/skin/default/loading-1.gif -------------------------------------------------------------------------------- /static/js/layer/skin/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/js/layer/skin/default/loading-2.gif -------------------------------------------------------------------------------- /users/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | -------------------------------------------------------------------------------- /consul_kv/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | -------------------------------------------------------------------------------- /kettle/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | -------------------------------------------------------------------------------- /salt_api/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | -------------------------------------------------------------------------------- /static/css/patterns/header-profile-skin-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/patterns/header-profile-skin-1.png -------------------------------------------------------------------------------- /static/css/patterns/header-profile-skin-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/patterns/header-profile-skin-2.png -------------------------------------------------------------------------------- /static/css/patterns/header-profile-skin-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/patterns/header-profile-skin-3.png -------------------------------------------------------------------------------- /static/css/plugins/chosen/chosen-sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/chosen/chosen-sprite@2x.png -------------------------------------------------------------------------------- /static/css/plugins/images/sprite-skin-flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/sprite-skin-flat.png -------------------------------------------------------------------------------- /static/css/plugins/images/sprite-skin-nice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/sprite-skin-nice.png -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /command_job/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | -------------------------------------------------------------------------------- /config_center/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ConfigCenterConfig(AppConfig): 5 | name = 'config_center' 6 | -------------------------------------------------------------------------------- /static/css/plugins/images/sprite-skin-flat2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/sprite-skin-flat2.png -------------------------------------------------------------------------------- /static/css/plugins/images/sprite-skin-simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/sprite-skin-simple.png -------------------------------------------------------------------------------- /static/css/vaildator/images/validator_simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/vaildator/images/validator_simple.png -------------------------------------------------------------------------------- /static/js/validator/images/validator_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/js/validator/images/validator_default.png -------------------------------------------------------------------------------- /static/js/validator/images/validator_simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/js/validator/images/validator_simple.png -------------------------------------------------------------------------------- /static/css/vaildator/images/validator_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/vaildator/images/validator_default.png -------------------------------------------------------------------------------- /static/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /static/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /static/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /static/css/plugins/images/bootstrap-colorpicker/hue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/bootstrap-colorpicker/hue.png -------------------------------------------------------------------------------- /static/css/plugins/images/bootstrap-colorpicker/alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/bootstrap-colorpicker/alpha.png -------------------------------------------------------------------------------- /web/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class WebConfig(AppConfig): 7 | name = 'web' 8 | -------------------------------------------------------------------------------- /www/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class WwwConfig(AppConfig): 7 | name = 'www' 8 | -------------------------------------------------------------------------------- /alert/models.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.db import models 5 | 6 | 7 | # Create your models here. 8 | -------------------------------------------------------------------------------- /asset/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class AssetConfig(AppConfig): 7 | name = 'asset' 8 | -------------------------------------------------------------------------------- /cache/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class CacheConfig(AppConfig): 7 | name = 'cache' 8 | -------------------------------------------------------------------------------- /cmdb/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class CmdbConfig(AppConfig): 7 | name = 'cmdb' 8 | -------------------------------------------------------------------------------- /disque/tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.test import TestCase 5 | 6 | # Create your tests here. 7 | -------------------------------------------------------------------------------- /logs/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class LogsConfig(AppConfig): 7 | name = 'logs' 8 | -------------------------------------------------------------------------------- /users/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class UsersConfig(AppConfig): 7 | name = 'users' 8 | -------------------------------------------------------------------------------- /kettle/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class KettleConfig(AppConfig): 7 | name = 'kettle' 8 | -------------------------------------------------------------------------------- /static/css/plugins/images/bootstrap-colorpicker/saturation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/bootstrap-colorpicker/saturation.png -------------------------------------------------------------------------------- /salt_api/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class SaltApiConfig(AppConfig): 7 | name = 'salt_api' 8 | -------------------------------------------------------------------------------- /static/css/plugins/images/bootstrap-colorpicker/hue-horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/bootstrap-colorpicker/hue-horizontal.png -------------------------------------------------------------------------------- /workflow/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class WorkflowConfig(AppConfig): 7 | name = 'workflow' 8 | -------------------------------------------------------------------------------- /static/css/plugins/images/bootstrap-colorpicker/alpha-horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ezbuy/cmdb/HEAD/static/css/plugins/images/bootstrap-colorpicker/alpha-horizontal.png -------------------------------------------------------------------------------- /subversion/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class SubversionConfig(AppConfig): 7 | name = 'subversion' 8 | -------------------------------------------------------------------------------- /static/font-awesome/less/fixed-width.less: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .@{fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /static/font-awesome/scss/_fixed-width.scss: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .#{$fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /winservices/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class WinservicesConfig(AppConfig): 7 | name = 'winservices' 8 | -------------------------------------------------------------------------------- /project_crontab/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class CrontabConfig(AppConfig): 7 | name = 'project_crontab' 8 | -------------------------------------------------------------------------------- /disque/apps.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.apps import AppConfig 5 | 6 | 7 | class DisqueConfig(AppConfig): 8 | name = 'disque' 9 | -------------------------------------------------------------------------------- /config_center/migrations/0002_auto_20170729_1758.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | -- 3 | -- Alter field category on resources 4 | -- 5 | ALTER TABLE `config_center_resources` MODIFY `category` integer NOT NULL; 6 | 7 | COMMIT; 8 | -------------------------------------------------------------------------------- /config_center/migrations/0003_auto_20170729_1804.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | -- 3 | -- Alter field category on resources 4 | -- 5 | ALTER TABLE `config_center_resources` MODIFY `category` varchar(16) NOT NULL; 6 | 7 | COMMIT; 8 | -------------------------------------------------------------------------------- /templates/footer.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /uwsgi_socket.xml: -------------------------------------------------------------------------------- 1 | 2 | :8001 3 | /home/mico/cmdb 4 | wsgi 5 | 4 6 | /home/mico/cmdb 7 | uwsgi.log 8 | -------------------------------------------------------------------------------- /cache/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from cache.models import * 3 | # Register your models here. 4 | 5 | 6 | class cacheAdmin(admin.ModelAdmin): 7 | list_display = ('memcacheName','env','saltMinion','ip','port') 8 | 9 | 10 | 11 | admin.site.register(memcache,cacheAdmin) -------------------------------------------------------------------------------- /consul_kv/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from django.conf.urls import url 3 | from consul_kv.views import consul_kv_index, consul_kv_req 4 | 5 | urlpatterns = [ 6 | url(r'^index/$', consul_kv_index, name='consul_kv_index'), 7 | url(r'^req/$', consul_kv_req, name='consul_kv_req'), 8 | ] 9 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mico.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /kettle/urls.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | from django.conf.urls import patterns, include, url 3 | from kettle.views import kettle_index,kettle_execute 4 | 5 | 6 | urlpatterns = [ 7 | url(r'^kettle_index/$', kettle_index, name='kettle_index'), 8 | url(r'^kettle_execute/$', kettle_execute, name='kettle_execute'), 9 | ] -------------------------------------------------------------------------------- /winservices/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from winservices.models import winconf 3 | # Register your models here. 4 | 5 | class winconfAdmin(admin.ModelAdmin): 6 | list_display = ('username','password','repo','localpath','env','servicename','hostname','tasklist_name') 7 | 8 | 9 | admin.site.register(winconf,winconfAdmin) -------------------------------------------------------------------------------- /cmdb/http.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | class SetRemoteAddrFromForwardedFor(object): 4 | def process_request(self,request): 5 | try: 6 | real_ip=request.META['HTTP_X_FORWARDED_FOR'] 7 | except KeyError: 8 | pass 9 | else: 10 | real_ip=real_ip.split(",")[0] 11 | request.META['REMOTE_ADDR']=real_ip 12 | -------------------------------------------------------------------------------- /subversion/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | 5 | from subversion.models import subversion 6 | 7 | 8 | class subversionAdmin(admin.ModelAdmin): 9 | list_display = ('env','hostname','svnparentpath','svnowner','svnrooturl','svnusername','svnpassword','svnpasswordfile') 10 | 11 | admin.site.register(subversion,subversionAdmin) 12 | -------------------------------------------------------------------------------- /web/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | 7 | class userLogin(models.Model): 8 | username = models.CharField(max_length=100) 9 | remote_ip = models.GenericIPAddressField() 10 | login_time = models.DateTimeField(auto_now=True) 11 | 12 | def __unicode__(self): 13 | return self.username -------------------------------------------------------------------------------- /disque/admin.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.contrib import admin 5 | from disque.models import ClusterInfo 6 | 7 | # Register your models here. 8 | 9 | 10 | class ClusterInfoAdmin(admin.ModelAdmin): 11 | list_display = ('name', 'addr') 12 | search_fields = ['name'] 13 | 14 | 15 | admin.site.register(ClusterInfo, ClusterInfoAdmin) 16 | -------------------------------------------------------------------------------- /www/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | from www.models import * 5 | 6 | 7 | class webSiteAdmin(admin.ModelAdmin): 8 | list_display = ('webSite','salt_pillar_host','svn_path','recycle_cmd','env') 9 | 10 | 11 | admin.site.register(webSite,webSiteAdmin) 12 | admin.site.register(salt_module) 13 | admin.site.register(webUrl) 14 | admin.site.register(groupName) -------------------------------------------------------------------------------- /static/font-awesome/less/bordered-pulled.less: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em @fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .pull-right { float: right; } 11 | .pull-left { float: left; } 12 | 13 | .@{fa-css-prefix} { 14 | &.pull-left { margin-right: .3em; } 15 | &.pull-right { margin-left: .3em; } 16 | } 17 | -------------------------------------------------------------------------------- /static/font-awesome/scss/_bordered-pulled.scss: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em $fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .pull-right { float: right; } 11 | .pull-left { float: left; } 12 | 13 | .#{$fa-css-prefix} { 14 | &.pull-left { margin-right: .3em; } 15 | &.pull-right { margin-left: .3em; } 16 | } 17 | -------------------------------------------------------------------------------- /static/font-awesome/less/larger.less: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .@{fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .@{fa-css-prefix}-2x { font-size: 2em; } 11 | .@{fa-css-prefix}-3x { font-size: 3em; } 12 | .@{fa-css-prefix}-4x { font-size: 4em; } 13 | .@{fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for mico project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mico.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /logs/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from logs.models import * 3 | # Register your models here. 4 | class goLogAdmin(admin.ModelAdmin): 5 | list_display = ('user','remote_ip','goAction','result','datetime') 6 | 7 | class publishLogAdmin(admin.ModelAdmin): 8 | list_display = ('user','remote_ip','publish_url','publish_result','datetime') 9 | 10 | admin.site.register(goLog,goLogAdmin) 11 | admin.site.register(publishLog,publishLogAdmin) 12 | -------------------------------------------------------------------------------- /mico/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for mico project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mico.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /static/font-awesome/scss/_larger.scss: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .#{$fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .#{$fa-css-prefix}-2x { font-size: 2em; } 11 | .#{$fa-css-prefix}-3x { font-size: 3em; } 12 | .#{$fa-css-prefix}-4x { font-size: 4em; } 13 | .#{$fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /disque/models.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.db import models 5 | 6 | # Create your models here. 7 | 8 | 9 | class ClusterInfo(models.Model): 10 | name = models.CharField(max_length=32, verbose_name=u"disque cluster alias name") 11 | addr = models.TextField(blank=True, null=True, default='', verbose_name=u"cluster address") 12 | 13 | def __unicode__(self): 14 | return self.name 15 | -------------------------------------------------------------------------------- /asset/migrations/0020_delete_disquecluster.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-03-08 10:30 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0019_auto_20180307_1149'), 12 | ] 13 | 14 | operations = [ 15 | migrations.DeleteModel( 16 | name='DisqueCluster', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /command_job/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from django.conf.urls import url 3 | from command_job.views import command_index, command_req, mautic_index, mautic_restart 4 | 5 | urlpatterns = [ 6 | url(r'^command_index/$', command_index, name='command_index'), 7 | url(r'^command_req/$', command_req, name='command_req'), 8 | url(r'^mautic_index/$', mautic_index, name='mautic_index'), 9 | url(r'^mautic_restart/$', mautic_restart, name='mautic_restart'), 10 | ] 11 | -------------------------------------------------------------------------------- /static/js/custom/bar.js: -------------------------------------------------------------------------------- 1 | /********************************* 2 | * Author: HuangYao 3 | * Content: 定义左侧导航栏动作 4 | *********************************/ 5 | 6 | $('.nav-second-level').find('a').each(function () { 7 | if (this.href == document.location.href || document.location.href.search(this.href) >= 0) { 8 | $(this).parent().addClass('active'); // this.className = 'active'; 9 | $(this).parent().parent().parent().addClass('active'); 10 | } 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /static/font-awesome/less/core.less: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix} { 5 | display: inline-block; 6 | font: normal normal normal 14px/1 FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | -------------------------------------------------------------------------------- /static/font-awesome/less/list.less: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: @fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .@{fa-css-prefix}-li { 11 | position: absolute; 12 | left: -@fa-li-width; 13 | width: @fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.@{fa-css-prefix}-lg { 17 | left: (-@fa-li-width + (4em / 14)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /asset/migrations/0016_delete_gotemplaterevision.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-09-05 16:38 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0015_auto_20170905_1604'), 12 | ] 13 | 14 | operations = [ 15 | migrations.DeleteModel( 16 | name='GoTemplateRevision', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /static/font-awesome/scss/_core.scss: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix} { 5 | display: inline-block; 6 | font: normal normal normal 14px/1 FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | -------------------------------------------------------------------------------- /static/font-awesome/scss/_list.scss: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: $fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .#{$fa-css-prefix}-li { 11 | position: absolute; 12 | left: -$fa-li-width; 13 | width: $fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.#{$fa-css-prefix}-lg { 17 | left: -$fa-li-width + (4em / 14); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /static/font-awesome/scss/font-awesome.scss: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables"; 7 | @import "mixins"; 8 | @import "path"; 9 | @import "core"; 10 | @import "larger"; 11 | @import "fixed-width"; 12 | @import "list"; 13 | @import "bordered-pulled"; 14 | @import "spinning"; 15 | @import "rotated-flipped"; 16 | @import "stacked"; 17 | @import "icons"; 18 | -------------------------------------------------------------------------------- /templates/getdata.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block content %} 4 | 5 |
6 |

服务发布上线后,请检查服务是否正常!!!

7 | {% for dic in result %} 8 | {% for k,v in dic.items %} 9 |

{{ k }}:

10 | 15 | {% endfor %} 16 | {% endfor %} 17 |
18 | 19 | 20 | 21 | {% endblock %} 22 | -------------------------------------------------------------------------------- /cmdb_api.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name _; 4 | access_log /var/log/nginx/cmdb_api.access.log main; 5 | error_log /var/log/nginx/cmdb_api.error.log; 6 | 7 | location / { 8 | proxy_set_header X-Real-Ip $remote_addr; 9 | proxy_set_header REMOTE-HOST $remote_addr; 10 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 11 | proxy_pass http://127.0.0.1:5001; 12 | proxy_connect_timeout 600; 13 | proxy_read_timeout 600; 14 | proxy_send_timeout 600; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /static/font-awesome/less/font-awesome.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables.less"; 7 | @import "mixins.less"; 8 | @import "path.less"; 9 | @import "core.less"; 10 | @import "larger.less"; 11 | @import "fixed-width.less"; 12 | @import "list.less"; 13 | @import "bordered-pulled.less"; 14 | @import "spinning.less"; 15 | @import "rotated-flipped.less"; 16 | @import "stacked.less"; 17 | @import "icons.less"; 18 | -------------------------------------------------------------------------------- /cache/migrations/0002_auto_20160715_1046.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-07-15 10:46 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('cache', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='memcache', 17 | name='memcacheName', 18 | field=models.CharField(max_length=64, unique=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /winservices/migrations/0002_auto_20160718_1358.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-07-18 13:58 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('winservices', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='winconf', 17 | name='tasklist_name', 18 | field=models.CharField(max_length=32), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /static/font-awesome/less/stacked.less: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .@{fa-css-prefix}-stack-1x, .@{fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .@{fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .@{fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .@{fa-css-prefix}-inverse { color: @fa-inverse; } 21 | -------------------------------------------------------------------------------- /asset/migrations/0022_goservices_level.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2018-05-14 14:33 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0021_goservices_ports'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='goservices', 17 | name='level', 18 | field=models.CharField(max_length=128, null=True, verbose_name='level'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /cache/models.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | from django.db import models 4 | from asset.models import minion,ASSET_ENV 5 | # Create your models here. 6 | 7 | 8 | class memcache(models.Model): 9 | saltMinion = models.ForeignKey(minion) 10 | env = models.IntegerField(choices=ASSET_ENV, blank=True, null=True, verbose_name=u"运行环境") 11 | ip = models.GenericIPAddressField() 12 | port = models.CharField(max_length=32,default="11211") 13 | memcacheName = models.CharField(max_length=64,unique=True) 14 | 15 | def __unicode__(self): 16 | return self.memcacheName 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /static/font-awesome/scss/_stacked.scss: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .#{$fa-css-prefix}-stack-1x, .#{$fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .#{$fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .#{$fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .#{$fa-css-prefix}-inverse { color: $fa-inverse; } 21 | -------------------------------------------------------------------------------- /www/migrations/0002_weburl_ip.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-10-12 16:24 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('www', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='weburl', 17 | name='ip', 18 | field=models.GenericIPAddressField(default='192.168.1.1'), 19 | preserve_default=False, 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /asset/migrations/0008_auto_20161220_1431.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-12-20 14:31 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0007_crontab_svn'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='gogroup', 17 | name='name', 18 | field=models.CharField(max_length=32, unique=True, verbose_name='go group name'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /asset/migrations/0021_goservices_ports.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2018-03-13 16:55 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0020_delete_disquecluster'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='goservices', 17 | name='ports', 18 | field=models.CharField(max_length=128, null=True, verbose_name='ports'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /asset/migrations/0012_auto_20170401_2134.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-04-01 21:34 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0011_auto_20170313_1420'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='goservices', 17 | name='name', 18 | field=models.CharField(max_length=128, verbose_name='goservices services name'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /asset/migrations/0019_auto_20180307_1149.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-03-07 11:49 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0018_disquecluster'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='disquecluster', 17 | name='addr', 18 | field=models.TextField(blank=True, default=b'', null=True, verbose_name='cluster address'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /asset/migrations/0002_auto_20160713_1448.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-07-13 14:48 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='asset', 17 | name='env', 18 | field=models.IntegerField(blank=True, max_length=32, null=True, verbose_name='\u8fd0\u884c\u73af\u5883'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /asset/migrations/0017_asset_wan_ip.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-11-28 17:54 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0016_delete_gotemplaterevision'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='asset', 17 | name='wan_ip', 18 | field=models.CharField(blank=True, max_length=8192, null=True, verbose_name='\u5916\u7f51IP'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /templates/head_script.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {##} 14 | {##} 15 | 16 | -------------------------------------------------------------------------------- /asset/migrations/0003_auto_20160713_1453.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-07-13 14:53 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0002_auto_20160713_1448'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='asset', 17 | name='env', 18 | field=models.CharField(blank=True, max_length=32, null=True, verbose_name='\u8fd0\u884c\u73af\u5883'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /django.conf: -------------------------------------------------------------------------------- 1 | server { 2 | send_timeout 600; 3 | listen 8000; 4 | server_name _; 5 | index index.html; 6 | location / { 7 | include uwsgi_params; 8 | uwsgi_pass 127.0.0.1:8001; 9 | uwsgi_connect_timeout 600; 10 | uwsgi_read_timeout 600; 11 | uwsgi_send_timeout 600; 12 | access_log /var/log/nginx/django.access.log; 13 | } 14 | location /static/admin/ { 15 | root /django; 16 | } 17 | location /static/ { 18 | root /home/mico/cmdb; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /config_center/migrations/0002_auto_20170729_1758.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2017-07-29 17:58 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('config_center', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='resources', 17 | name='category', 18 | field=models.IntegerField(choices=[(1, 'db'), (2, 'ops')], verbose_name='\u6240\u5c5e\u7c7b\u522b'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /config_center/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from config_center.models import Resources, SVCResources, ResTypes 4 | 5 | 6 | # Register your models here. 7 | 8 | 9 | class ResourcesAdmin(admin.ModelAdmin): 10 | list_display = ('name', 'type', 'category', 'comment') 11 | 12 | 13 | class SVCResourcesAdmin(admin.ModelAdmin): 14 | list_display = ('svc', 'res') 15 | 16 | 17 | class ResTypesAdmin(admin.ModelAdmin): 18 | list_display = ('name',) 19 | 20 | 21 | admin.site.register(Resources, ResourcesAdmin) 22 | admin.site.register(SVCResources, SVCResourcesAdmin) 23 | admin.site.register(ResTypes, ResTypesAdmin) 24 | -------------------------------------------------------------------------------- /workflow/migrations/0003_webinfo_type.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2018-01-30 16:30 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('workflow', '0002_webinfo'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='webinfo', 17 | name='type', 18 | field=models.IntegerField(blank=True, choices=[(1, 'web\u7ad9'), (2, 'M\u7ad9')], null=True, verbose_name='\u7ad9\u70b9\u7c7b\u578b'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /config_center/migrations/0003_auto_20170729_1804.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2017-07-29 18:04 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('config_center', '0002_auto_20170729_1758'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='resources', 17 | name='category', 18 | field=models.CharField(choices=[('db', 'db'), ('ops', 'ops')], max_length=16, verbose_name='\u6240\u5c5e\u7c7b\u522b'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /cmdb_api_supervisor.conf: -------------------------------------------------------------------------------- 1 | [program:cmdb_api] 2 | command=/usr/bin/python /home/mico/cmdb/cmdb_api.py 3 | numprocs=1 4 | numprocs_start=0 5 | priority=999 6 | autostart=true 7 | autorestart=unexpected 8 | startsecs=3 9 | startretries=3 10 | exitcodes=0,2 11 | stopsignal=TERM 12 | stopwaitsecs=20 13 | directory=/home/mico/cmdb 14 | user=root 15 | stopasgroup=false 16 | killasgroup=false 17 | redirect_stderr=true 18 | stdout_logfile=/var/log/django.cmdb_api.access.log 19 | stdout_logfile_maxbytes=100MB 20 | stdout_logfile_backups=10 21 | stderr_logfile=/var/log/django.cmdb_api.error.log 22 | stderr_logfile_maxbytes=100MB 23 | stderr_logfile_backups=10 24 | environment=PYTHONPATH='/home/mico/cmdb' 25 | -------------------------------------------------------------------------------- /templates/nav_cat_bar.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ header_title }}

4 | 19 |
20 |
21 |
22 |
23 | -------------------------------------------------------------------------------- /asset/migrations/0011_auto_20170313_1420.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-03-13 14:20 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | ('asset', '0010_userprofile'), 14 | ] 15 | 16 | operations = [ 17 | migrations.AlterField( 18 | model_name='userprofile', 19 | name='user', 20 | field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /mico/celery.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | import os 3 | from celery import Celery,platforms 4 | from django.conf import settings 5 | 6 | 7 | # set the default Django settings module for the 'celery' program. 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mico.settings') 9 | 10 | app = Celery('mico') 11 | 12 | 13 | # Using a string here means the worker will not have to 14 | # pickle the object when using Windows. 15 | app.config_from_object('django.conf:settings') 16 | app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) 17 | platforms.C_FORCE_ROOT = True 18 | 19 | 20 | @app.task(bind=True) 21 | def debug_task(self): 22 | print('Request: {0!r}'.format(self.request)) 23 | -------------------------------------------------------------------------------- /project_crontab/urls.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | from django.conf.urls import patterns, include, url 3 | from project_crontab.views import * 4 | 5 | urlpatterns = patterns('', 6 | url(r'^cronList/$', crontabList, name='crontabList'), 7 | url(r'^cronList/add/$', addCrontab, name='addCrontab'), 8 | url(r'^cronList/modify/$', modifyCrontab, name='modifyCrontab'), 9 | url(r'^cronList/del/$', delCrontab, name='delCrontab'), 10 | url(r'^cronList/start/$', startCrontab, name='startCrontab'), 11 | url(r'^cronList/pause/$', pauseCrontab, name='pauseCrontab'), 12 | ) 13 | -------------------------------------------------------------------------------- /django_celery.conf: -------------------------------------------------------------------------------- 1 | [program:django_celery] 2 | command=/usr/bin/python /home/mico/cmdb/manage.py celery worker --loglevel=info 3 | numprocs=1 4 | numprocs_start=0 5 | priority=999 6 | autostart=true 7 | autorestart=unexpected 8 | startsecs=3 9 | startretries=3 10 | exitcodes=0,2 11 | stopsignal=TERM 12 | stopwaitsecs=20 13 | directory=/home/mico/cmdb 14 | user=root 15 | stopasgroup=false 16 | killasgroup=false 17 | redirect_stderr=true 18 | stdout_logfile=/var/log/django.celery.access.log 19 | stdout_logfile_maxbytes=100MB 20 | stdout_logfile_backups=10 21 | stderr_logfile=/var/log/django.celery.error.log 22 | stderr_logfile_maxbytes=100MB 23 | stderr_logfile_backups=10 24 | environment=PYTHONPATH='/home/mico/cmdb' 25 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | root=`pwd` 2 | sudo pip install django==1.9 3 | sudo pip install MySQL-python 4 | sudo pip install redis 5 | sudo pip install celery 6 | sudo pip install django-celery==3.1.17 7 | sudo pip install uwsgi 8 | sudo apt-get install redis-server supervisor salt-master salt-api salt-minion -y 9 | sudo python manage.py collectstatic 10 | sudo uwsgi -x uwsgi_socket.xml -b 32768 11 | sudo cp django.conf /etc/nginx/sites-enabled/ 12 | sudo cp django_celery.conf /etc/supervisor/conf.d/ 13 | sudo sed -i "s#/home/mico/cmdb#$root#g" /etc/nginx/sites-enabled/django.conf 14 | sudo sed -i "s#/home/mico/cmdb#$root#g" /etc/supervisor/conf.d/django_celery.conf 15 | sudo /etc/init.d/nginx reload 16 | sudo supervisorctl update 17 | -------------------------------------------------------------------------------- /winservices/models.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | 4 | from django.db import models 5 | from asset.models import minion,ASSET_ENV 6 | # Create your models here. 7 | 8 | 9 | class winconf(models.Model): 10 | username = models.CharField(max_length=32) 11 | password = models.CharField(max_length=32) 12 | repo = models.CharField(max_length=128) 13 | localpath = models.CharField(max_length=64) 14 | env = models.IntegerField(choices=ASSET_ENV, blank=True, null=True, verbose_name=u"运行环境") 15 | servicename = models.CharField(max_length=32) 16 | hostname = models.ForeignKey(minion) 17 | tasklist_name = models.CharField(max_length=32) 18 | 19 | def __unicode__(self): 20 | return self.servicename -------------------------------------------------------------------------------- /cmdb_cronjob_api_supervisor.conf: -------------------------------------------------------------------------------- 1 | [program:cmdb_cronjob_api] 2 | command=/usr/bin/python /home/mico/cmdb/cronjob_api.py 3 | numprocs=1 4 | numprocs_start=0 5 | priority=999 6 | autostart=true 7 | autorestart=unexpected 8 | startsecs=3 9 | startretries=3 10 | exitcodes=0,2 11 | stopsignal=TERM 12 | stopwaitsecs=20 13 | directory=/home/mico/cmdb 14 | user=root 15 | stopasgroup=false 16 | killasgroup=false 17 | redirect_stderr=true 18 | stdout_logfile=/var/log/django.cmdb_cronjob_api.access.log 19 | stdout_logfile_maxbytes=100MB 20 | stdout_logfile_backups=10 21 | stderr_logfile=/var/log/django.cmdb_cronjob_api.error.log 22 | stderr_logfile_maxbytes=100MB 23 | stderr_logfile_backups=10 24 | environment=PYTHONPATH='/home/mico/cmdb' 25 | -------------------------------------------------------------------------------- /cmdb/templatetags/cmdbtags.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | 3 | from django.contrib.auth.models import Group 4 | from django import template 5 | import datetime 6 | register = template.Library() 7 | 8 | 9 | @register.filter(name='has_group') 10 | def has_group(user, group_name): 11 | try: 12 | group = Group.objects.get(name=group_name) 13 | return True if group in user.groups.all() else False 14 | 15 | except Exception, e: 16 | print e 17 | return False 18 | 19 | @register.filter(name='print_timestamp') 20 | def print_timestamp(timestamp): 21 | try: 22 | ts = float(timestamp) 23 | except ValueError: 24 | return None 25 | return datetime.datetime.fromtimestamp(ts) 26 | -------------------------------------------------------------------------------- /static/font-awesome/less/rotated-flipped.less: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); } 5 | .@{fa-css-prefix}-rotate-180 { .fa-icon-rotate(180deg, 2); } 6 | .@{fa-css-prefix}-rotate-270 { .fa-icon-rotate(270deg, 3); } 7 | 8 | .@{fa-css-prefix}-flip-horizontal { .fa-icon-flip(-1, 1, 0); } 9 | .@{fa-css-prefix}-flip-vertical { .fa-icon-flip(1, -1, 2); } 10 | 11 | // Hook for IE8-9 12 | // ------------------------- 13 | 14 | :root .@{fa-css-prefix}-rotate-90, 15 | :root .@{fa-css-prefix}-rotate-180, 16 | :root .@{fa-css-prefix}-rotate-270, 17 | :root .@{fa-css-prefix}-flip-horizontal, 18 | :root .@{fa-css-prefix}-flip-vertical { 19 | filter: none; 20 | } 21 | -------------------------------------------------------------------------------- /static/font-awesome/less/spinning.less: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .@{fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | @-webkit-keyframes fa-spin { 10 | 0% { 11 | -webkit-transform: rotate(0deg); 12 | transform: rotate(0deg); 13 | } 14 | 100% { 15 | -webkit-transform: rotate(359deg); 16 | transform: rotate(359deg); 17 | } 18 | } 19 | 20 | @keyframes fa-spin { 21 | 0% { 22 | -webkit-transform: rotate(0deg); 23 | transform: rotate(0deg); 24 | } 25 | 100% { 26 | -webkit-transform: rotate(359deg); 27 | transform: rotate(359deg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /static/font-awesome/scss/_spinning.scss: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .#{$fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | @-webkit-keyframes fa-spin { 10 | 0% { 11 | -webkit-transform: rotate(0deg); 12 | transform: rotate(0deg); 13 | } 14 | 100% { 15 | -webkit-transform: rotate(359deg); 16 | transform: rotate(359deg); 17 | } 18 | } 19 | 20 | @keyframes fa-spin { 21 | 0% { 22 | -webkit-transform: rotate(0deg); 23 | transform: rotate(0deg); 24 | } 25 | 100% { 26 | -webkit-transform: rotate(359deg); 27 | transform: rotate(359deg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /logs/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,render_to_response,HttpResponse 2 | from django.contrib.auth.decorators import login_required 3 | from django.core.paginator import Paginator,EmptyPage,PageNotAnInteger 4 | # Create your views here. 5 | from logs.models import goLog 6 | 7 | @login_required 8 | def logs(request): 9 | logs_list = goLog.objects.all().order_by('-datetime') 10 | paginator = Paginator(logs_list,20) 11 | page = request.GET.get('page') 12 | 13 | try: 14 | contacts = paginator.page(page) 15 | except PageNotAnInteger: 16 | contacts = paginator.page(1) 17 | except EmptyPage: 18 | contacts = paginator.page(paginator.num_pages) 19 | 20 | return render(request,'logs/logs.html',{'logs':contacts}) 21 | -------------------------------------------------------------------------------- /static/font-awesome/less/path.less: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('@{fa-font-path}/fontawesome-webfont.eot?v=@{fa-version}'); 7 | src: url('@{fa-font-path}/fontawesome-webfont.eot?#iefix&v=@{fa-version}') format('embedded-opentype'), 8 | url('@{fa-font-path}/fontawesome-webfont.woff?v=@{fa-version}') format('woff'), 9 | url('@{fa-font-path}/fontawesome-webfont.ttf?v=@{fa-version}') format('truetype'), 10 | url('@{fa-font-path}/fontawesome-webfont.svg?v=@{fa-version}#fontawesomeregular') format('svg'); 11 | // src: url('@{fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 12 | font-weight: normal; 13 | font-style: normal; 14 | } 15 | -------------------------------------------------------------------------------- /www/migrations/0003_groupname.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-10-18 15:54 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('www', '0002_weburl_ip'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='groupName', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('group_name', models.CharField(max_length=64)), 20 | ('member', models.ManyToManyField(to='www.webSite')), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /www/urls.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | from django.conf.urls import patterns, include, url 3 | from www.views import * 4 | 5 | urlpatterns = patterns('', 6 | url(r'^list/$', list, name='www_list'), 7 | url(r'^wwwList$',wwwList,name='wwwList'), 8 | url(r'^getProjectName$',getProjectName,name='getProjectName'), 9 | url(r'^deployIis$',deployIis,name='deployIis'), 10 | url(r'^recycleList$', recycleList, name='recycleList'), 11 | url(r'^deployRecycle$', deployRecycle, name='deployRecycle'), 12 | url(r'^wwwRevertList$', wwwRevertList, name='wwwRevertList'), 13 | url(r'^deployRevertIis$', deployRevertIis, name='deployRevertIis'), 14 | url(r'^getGroup$', getGroup, name='getGroup'), 15 | url(r'^deployGroup$', deployGroup, name='deployGroup'), 16 | ) -------------------------------------------------------------------------------- /static/font-awesome/scss/_path.scss: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}'); 7 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'), 8 | url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'), 9 | url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'), 10 | url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg'); 11 | //src: url('#{$fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 12 | font-weight: normal; 13 | font-style: normal; 14 | } 15 | -------------------------------------------------------------------------------- /templates/link_css.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /cronjob_api.py: -------------------------------------------------------------------------------- 1 | from flask import Flask,request,jsonify 2 | from crontab import CronTab 3 | import commands 4 | app = Flask(__name__) 5 | 6 | @app.route('/',methods=['POST']) 7 | def main(): 8 | fun = request.json.get('fun') 9 | if fun == 'list': 10 | return jsonify({'result':get_crontab_list()}) 11 | else: 12 | return jsonify({'result':0}) 13 | 14 | def get_crontab_list(): 15 | cron = CronTab(tabfile='/etc/crontab',user=False) 16 | cron_list = [] 17 | for info in cron[4:]: 18 | status,time = commands.getstatusoutput("grep '%s' /var/log/cron.log | tail -n 1 | awk \'{print $1,$2,$3}\'" % info.command) 19 | cron_list.append({str(info):time}) 20 | return cron_list 21 | 22 | if __name__ == '__main__': 23 | app.run(host='0.0.0.0',port=5000) -------------------------------------------------------------------------------- /static/font-awesome/scss/_rotated-flipped.scss: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); } 5 | .#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); } 6 | .#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); } 7 | 8 | .#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); } 9 | .#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); } 10 | 11 | // Hook for IE8-9 12 | // ------------------------- 13 | 14 | :root .#{$fa-css-prefix}-rotate-90, 15 | :root .#{$fa-css-prefix}-rotate-180, 16 | :root .#{$fa-css-prefix}-rotate-270, 17 | :root .#{$fa-css-prefix}-flip-horizontal, 18 | :root .#{$fa-css-prefix}-flip-vertical { 19 | filter: none; 20 | } 21 | -------------------------------------------------------------------------------- /web/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-13 13:40 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='userLogin', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('username', models.CharField(max_length=100)), 21 | ('remote_ip', models.GenericIPAddressField()), 22 | ('login_time', models.DateTimeField(auto_now=True)), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /disque/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-13 13:40 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='ClusterInfo', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('name', models.CharField(max_length=32, verbose_name='disque cluster alias name')), 21 | ('addr', models.TextField(blank=True, default='', null=True, verbose_name='cluster address')), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /workflow/migrations/0002_webinfo.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2018-01-30 16:05 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('workflow', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='WebInfo', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('site_name', models.CharField(max_length=128, verbose_name='\u7ad9\u70b9\u540d')), 20 | ('site_value', models.CharField(max_length=128, verbose_name='\u7ad9\u70b9\u503c')), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /logs/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | 7 | class goLog(models.Model): 8 | user = models.CharField(max_length=100) 9 | remote_ip = models.GenericIPAddressField() 10 | goAction = models.TextField() 11 | result = models.TextField(default='') 12 | datetime = models.DateTimeField(auto_now=True) 13 | 14 | def __unicode__(self): 15 | return self.goAction 16 | 17 | class publishLog(models.Model): 18 | user = models.CharField(max_length=100) 19 | remote_ip = models.GenericIPAddressField() 20 | publish_url = models.TextField(default='') 21 | publish_result = models.TextField(default='') 22 | datetime = models.DateTimeField(auto_now=True) 23 | 24 | def __unicode__(self): 25 | return self.publish_url 26 | -------------------------------------------------------------------------------- /subversion/models.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | from django.db import models 4 | from asset.models import ASSET_ENV,minion 5 | # Create your models here. 6 | 7 | class subversion(models.Model): 8 | env = models.IntegerField(choices=ASSET_ENV, blank=True, null=True, verbose_name=u"运行环境") 9 | hostname = models.ForeignKey(minion) 10 | svnparentpath = models.CharField(max_length=32, blank=True, null=True, default='/srv/svn/') 11 | svnowner = models.CharField(max_length=32, blank=True, null=True, default='www-data:www-data') 12 | svnrooturl = models.CharField(max_length=32) 13 | svnusername = models.CharField(max_length=32) 14 | svnpassword = models.CharField(max_length=32) 15 | svnpasswordfile = models.CharField(max_length=32) 16 | 17 | def __unicode__(self): 18 | return self.svnrooturl 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /asset/migrations/0018_disquecluster.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-03-07 11:44 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0017_asset_wan_ip'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='DisqueCluster', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('name', models.CharField(max_length=32, verbose_name='disque cluster alias name')), 20 | ('addr', models.CharField(blank=True, default=b'', max_length=128, null=True, verbose_name='disque address')), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /logs/urls.py: -------------------------------------------------------------------------------- 1 | """mico URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url,include 17 | from django.contrib import admin 18 | from logs.views import * 19 | 20 | urlpatterns = [ 21 | 22 | url(r'^logs/$', logs, name='logs'), 23 | 24 | ] -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | amqp==1.4.9 2 | anyjson==0.3.3 3 | backports-abc==0.5 4 | beautifulsoup4==4.6.0 5 | billiard==3.3.0.23 6 | celery==3.1.17 7 | certifi==2017.4.17 8 | chardet==3.0.4 9 | Django==1.9 10 | django-celery==3.1.17 11 | future==0.16.0 12 | futures==3.1.1 13 | idna==2.5 14 | ipaddress==1.0.18 15 | jenkinsapi==0.3.4 16 | Jinja2==2.9.6 17 | kombu==3.0.37 18 | MarkupSafe==1.0 19 | msgpack-python==0.4.8 20 | MySQL-python==1.2.5 21 | ndg-httpsclient==0.4.4 22 | pyasn1==0.4.2 23 | pydisque==0.1.2 24 | pyOpenSSL==17.5.0 25 | python-consul==0.7.2 26 | python-gitlab==0.21.2 27 | pytz==2017.2 28 | PyYAML==3.12 29 | pyzabbix==0.7.4 30 | pyzmq==16.0.2 31 | qcloudapi-sdk-python==2.0.10 32 | qingcloud-sdk==1.2 33 | redis==2.10.5 34 | requests==2.18.1 35 | salt==2016.11.6 36 | singledispatch==3.4.0.3 37 | tornado==4.5.1 38 | urllib3==1.21.1 39 | python-crontab==2.3.4 40 | django-crontab==0.7.1 41 | croniter==0.3.24 42 | -------------------------------------------------------------------------------- /asset/migrations/0015_auto_20170905_1604.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-09-05 16:04 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0014_gotemplaterevision'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='goservicerevision', 17 | name='gotemplate_last_rev', 18 | field=models.IntegerField(default=1, verbose_name='gotemplate latest successful revision'), 19 | preserve_default=False, 20 | ), 21 | migrations.AlterField( 22 | model_name='goservicerevision', 23 | name='last_rev', 24 | field=models.IntegerField(verbose_name='goproject latest successful revision'), 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /static/js/demo/peity-demo.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $("span.pie").peity("pie", { 3 | fill: ['#1ab394', '#d7d7d7', '#ffffff'] 4 | }) 5 | 6 | $(".line").peity("line",{ 7 | fill: '#1ab394', 8 | stroke:'#169c81', 9 | }) 10 | 11 | $(".bar").peity("bar", { 12 | fill: ["#1ab394", "#d7d7d7"] 13 | }) 14 | 15 | $(".bar_dashboard").peity("bar", { 16 | fill: ["#1ab394", "#d7d7d7"], 17 | width:100 18 | }) 19 | 20 | var updatingChart = $(".updating-chart").peity("line", { fill: '#1ab394',stroke:'#169c81', width: 64 }) 21 | 22 | setInterval(function() { 23 | var random = Math.round(Math.random() * 10) 24 | var values = updatingChart.text().split(",") 25 | values.shift() 26 | values.push(random) 27 | 28 | updatingChart 29 | .text(values.join(",")) 30 | .change() 31 | }, 1000); 32 | 33 | }); 34 | -------------------------------------------------------------------------------- /asset/migrations/0004_auto_20160713_1517.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-07-13 15:17 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0003_auto_20160713_1453'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='asset', 17 | name='asset_type', 18 | field=models.CharField(blank=True, max_length=32, null=True, verbose_name='\u4e3b\u673a\u7c7b\u578b'), 19 | ), 20 | migrations.AlterField( 21 | model_name='asset', 22 | name='env', 23 | field=models.IntegerField(blank=True, choices=[(1, '\u751f\u4ea7\u73af\u5883'), (2, '\u6d4b\u8bd5\u73af\u5883')], null=True, verbose_name='\u8fd0\u884c\u73af\u5883'), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /templates/nav_bar_header.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ezbuy | CMDB 10 | 11 | 12 | {% include 'link_css.html' %} 13 | {% include 'head_script.html' %} 14 | {% block self_head_css_js %} {% endblock %} 15 | 16 | 17 | 18 | 19 |
20 | {% include 'nav.html' %} 21 |
22 |
23 | {% include 'nav_bar_header.html' %} 24 |
25 | {% block content %}{% endblock %} 26 | {% include 'footer.html' %} 27 |
28 |
29 | 30 | 31 | {% include 'foot_script.html' %} 32 | {% block self_footer_js %} {% endblock %} 33 | 34 | -------------------------------------------------------------------------------- /asset/migrations/0014_gotemplaterevision.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-09-05 10:47 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0013_auto_20170704_1645'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='GoTemplateRevision', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('name', models.CharField(max_length=128, verbose_name='Go Project')), 20 | ('last_rev', models.IntegerField(verbose_name='latest successful revision')), 21 | ('last_clock', models.IntegerField(verbose_name='latest successful timestamp')), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /logs/migrations/0002_publishlog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-02-09 15:55 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('logs', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='publishLog', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('user', models.CharField(max_length=100)), 20 | ('remote_ip', models.GenericIPAddressField()), 21 | ('publish_url', models.TextField(default='')), 22 | ('publish_result', models.TextField(default='')), 23 | ('datetime', models.DateTimeField(auto_now=True)), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /asset/migrations/0005_gobuild.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-08-04 14:08 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('asset', '0004_auto_20160713_1517'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='gobuild', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('env', models.IntegerField(blank=True, choices=[(1, '\u751f\u4ea7\u73af\u5883'), (2, '\u6d4b\u8bd5\u73af\u5883')], null=True, verbose_name='\u8fd0\u884c\u73af\u5883')), 21 | ('hostname', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='asset.minion')), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /asset/migrations/0010_userprofile.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-03-09 13:54 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ('asset', '0009_gotemplate'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='UserProfile', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('phone_number', models.CharField(max_length=11)), 23 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, unique=True)), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /templates/wwwGroup.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 | 5 | 6 |

7 | IIS发布帮助文档 8 |

9 | 10 | 11 |
12 |
13 |
14 | 15 | 16 | 17 | 22 |
23 | 24 |
25 | 26 | {% endblock %} 27 | -------------------------------------------------------------------------------- /workflow/admin.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | from django.contrib import admin 3 | from workflow.models import TicketType,TicketTasks,TicketOperating,WebInfo 4 | 5 | # Register your models here. 6 | 7 | 8 | class TicketTypeAdmin(admin.ModelAdmin): 9 | list_display = ('type_name','create_time','modify_time','state') 10 | 11 | class TicketTasksAdmin(admin.ModelAdmin): 12 | list_display = ('tasks_id','title','ticket_type','creator','handler','content','create_time','modify_time','state') 13 | 14 | class TicketOperatingAdmin(admin.ModelAdmin): 15 | list_display = ('operating_id','submitter','handler','create_time','modify_time','content','result') 16 | 17 | class WebInfoAdmin(admin.ModelAdmin): 18 | list_display = ('site_name','site_value','type') 19 | 20 | admin.site.register(TicketType,TicketTypeAdmin) 21 | admin.site.register(TicketTasks,TicketTasksAdmin) 22 | admin.site.register(TicketOperating,TicketOperatingAdmin) 23 | admin.site.register(WebInfo,WebInfoAdmin) 24 | 25 | 26 | -------------------------------------------------------------------------------- /cache/urls.py: -------------------------------------------------------------------------------- 1 | """mico URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url,include 17 | from django.contrib import admin 18 | from cache.views import memcached,flushMemcached 19 | 20 | urlpatterns = [ 21 | 22 | url(r'^memcache/$', memcached, name='memcache'), 23 | url(r'^flushMemcache/$', flushMemcached, name='flushMemcache'), 24 | 25 | ] -------------------------------------------------------------------------------- /config_center/urls.py: -------------------------------------------------------------------------------- 1 | """URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url 17 | 18 | from config_center.views import service_list, resource_list 19 | 20 | urlpatterns = [ 21 | url(r'^index/$', service_list), 22 | url(r'^services/$', service_list, name='service_list'), 23 | url(r'^resources/$', resource_list, name='resource_list'), 24 | ] 25 | -------------------------------------------------------------------------------- /static/font-awesome/less/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | .fa-icon() { 5 | display: inline-block; 6 | font: normal normal normal 14px/1 FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | 13 | .fa-icon-rotate(@degrees, @rotation) { 14 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation); 15 | -webkit-transform: rotate(@degrees); 16 | -ms-transform: rotate(@degrees); 17 | transform: rotate(@degrees); 18 | } 19 | 20 | .fa-icon-flip(@horiz, @vert, @rotation) { 21 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation, mirror=1); 22 | -webkit-transform: scale(@horiz, @vert); 23 | -ms-transform: scale(@horiz, @vert); 24 | transform: scale(@horiz, @vert); 25 | } 26 | -------------------------------------------------------------------------------- /config_center/models.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*_ 2 | from __future__ import unicode_literals 3 | 4 | from django.db import models 5 | from asset.models import gogroup 6 | 7 | 8 | # Create your models here. 9 | CATEGORIES = ( 10 | (u'db', u'db'), 11 | (u'ops', u'ops'), 12 | ) 13 | 14 | 15 | class ResTypes(models.Model): 16 | name = models.CharField(max_length=32, default='mysql', verbose_name=u'资源类型') 17 | 18 | def __unicode__(self): 19 | return self.name 20 | 21 | 22 | class Resources(models.Model): 23 | name = models.CharField(max_length=128, verbose_name=u'资源唯一标识') 24 | type = models.ForeignKey(ResTypes, verbose_name=u'资源类型') 25 | category = models.CharField(max_length=16, choices=CATEGORIES, verbose_name=u'所属类别') 26 | comment = models.CharField(max_length=256, default='', verbose_name=u'资源说明') 27 | 28 | def __unicode__(self): 29 | return self.name 30 | 31 | 32 | class SVCResources(models.Model): 33 | svc = models.ForeignKey(gogroup) 34 | res = models.ForeignKey(Resources) 35 | -------------------------------------------------------------------------------- /static/font-awesome/scss/_mixins.scss: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | @mixin fa-icon() { 5 | display: inline-block; 6 | font: normal normal normal 14px/1 FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | 13 | @mixin fa-icon-rotate($degrees, $rotation) { 14 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}); 15 | -webkit-transform: rotate($degrees); 16 | -ms-transform: rotate($degrees); 17 | transform: rotate($degrees); 18 | } 19 | 20 | @mixin fa-icon-flip($horiz, $vert, $rotation) { 21 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}); 22 | -webkit-transform: scale($horiz, $vert); 23 | -ms-transform: scale($horiz, $vert); 24 | transform: scale($horiz, $vert); 25 | } 26 | -------------------------------------------------------------------------------- /asset/migrations/0002_auto_20180613_1342.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-13 13:42 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveField( 16 | model_name='goservices', 17 | name='levels', 18 | ), 19 | migrations.RemoveField( 20 | model_name='goservices', 21 | name='port', 22 | ), 23 | migrations.AddField( 24 | model_name='goservices', 25 | name='level', 26 | field=models.CharField(max_length=128, null=True, verbose_name='level'), 27 | ), 28 | migrations.AddField( 29 | model_name='goservices', 30 | name='ports', 31 | field=models.CharField(max_length=128, null=True, verbose_name='ports'), 32 | ), 33 | ] 34 | -------------------------------------------------------------------------------- /disque/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """URL Configuration 4 | 5 | The `urlpatterns` list routes URLs to views. For more information please see: 6 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 7 | Examples: 8 | Function views 9 | 1. Add an import: from my_app import views 10 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 11 | Class-based views 12 | 1. Add an import: from other_app.views import Home 13 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 14 | Including another URLconf 15 | 1. Import the include() function: from django.conf.urls import url, include 16 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 17 | """ 18 | 19 | from django.conf.urls import url 20 | 21 | from disque import views 22 | 23 | urlpatterns = [ 24 | url(r'^ackjob/$', views.ackjob_index, name="ackjob"), 25 | url(r'^addjob/$', views.addjob_index, name="addjob"), 26 | url(r'^api/addjob/$', views.add_job), 27 | url(r'^api/ackjob/$', views.ack_job) 28 | ] 29 | -------------------------------------------------------------------------------- /kettle/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,HttpResponse 2 | from django.contrib.auth.decorators import login_required 3 | from utils import kettle_run 4 | from asset.utils import deny_resubmit 5 | from mico.settings import kettle_log_url 6 | 7 | 8 | # Create your views here. 9 | 10 | @login_required 11 | @deny_resubmit(page_key='kettle') 12 | def kettle_index(request): 13 | return render(request,'kettleIndex.html') 14 | 15 | 16 | @login_required 17 | @deny_resubmit(page_key='kettle') 18 | def kettle_execute(request): 19 | cmd_type = request.POST['type'] 20 | kettle_file = request.POST['file'] 21 | kettle_log_file = request.POST['kettle_log_file'] 22 | ip = request.META['REMOTE_ADDR'] 23 | username = request.user 24 | return_date = kettle_run.delay(username,ip,cmd_type,kettle_file,kettle_log_file,request.POST['phone_number']) 25 | #print return_date 26 | result = [{'kettle':'The kettle is running,please check kettle log file(%s%s)!' % (kettle_log_url,kettle_log_file)}] 27 | return render(request,'getdata.html',{'result':result}) 28 | 29 | -------------------------------------------------------------------------------- /asset/migrations/0006_gostatus.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-11-17 11:39 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('asset', '0005_gobuild'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='gostatus', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('supervisor_host', models.CharField(default=b'192.168.1.1', max_length=128)), 21 | ('supervisor_username', models.CharField(max_length=64)), 22 | ('supervisor_password', models.CharField(max_length=64)), 23 | ('supervisor_port', models.CharField(default=b'9001', max_length=128)), 24 | ('hostname', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='asset.minion')), 25 | ], 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /templates/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ezbuy | 500 Error 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |

500

24 |

Internal Server Error

25 | 26 |
27 | The server encountered something unexpected that didn't allow it to complete the request. We apologize.
28 | 29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /asset/migrations/0013_auto_20170704_1645.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-07-04 16:45 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('asset', '0012_auto_20170401_2134'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='GoServiceRevision', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('name', models.CharField(max_length=128, verbose_name='Go Service name')), 20 | ('last_rev', models.IntegerField(verbose_name='latest successful revision')), 21 | ('last_clock', models.IntegerField(verbose_name='latest successful timestamp')), 22 | ], 23 | ), 24 | migrations.AlterField( 25 | model_name='asset', 26 | name='ip', 27 | field=models.CharField(blank=True, max_length=8192, null=True, verbose_name='\u4e3b\u673aIP'), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /project_crontab/utils.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | import commands 3 | 4 | from asset import utils 5 | from salt_api.api import SaltApi 6 | salt_api = SaltApi() 7 | 8 | 9 | def salt_run_sls(login_user, svnrepo, projectname, salt_hostname, login_ip): 10 | errcode = 0 11 | msg = 'ok' 12 | try: 13 | pillar = '''pillar=\"{'svnrepo': '%s', 'goprograme': '%s'}\"''' % (svnrepo, projectname) 14 | pull_svn_cmd = "salt " + salt_hostname + " state.sls queue=True goservices.pull_svn " + pillar 15 | print 'pull_svn_cmd : ' 16 | print pull_svn_cmd 17 | s, result = commands.getstatusoutput(pull_svn_cmd) 18 | if result.find('Failed: 0') < 0: 19 | utils.logs(login_user, login_ip, 'pull svn ' + projectname, 'Failed') 20 | print 'result : ' 21 | print result 22 | errcode = 501 23 | msg = u'salt执行不成功:\n' 24 | msg += result.split('\n')[0] 25 | else: 26 | utils.logs(login_user, login_ip, 'pull svn ' + projectname, 'Successful') 27 | except Exception as e: 28 | errcode = 500 29 | msg = u'salt执行失败' 30 | return errcode, msg 31 | -------------------------------------------------------------------------------- /asset/migrations/0007_crontab_svn.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-11-21 11:28 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('asset', '0006_gostatus'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='crontab_svn', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('username', models.CharField(max_length=32)), 21 | ('password', models.CharField(max_length=32)), 22 | ('repo', models.CharField(default=b'http://svn.abc.com/svn/test', max_length=128)), 23 | ('localpath', models.CharField(default=b'/srv/testsvn', max_length=64)), 24 | ('project', models.CharField(max_length=64)), 25 | ('hostname', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='asset.minion')), 26 | ], 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /templates/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ezbuy | 404 Error 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |

404

24 |

Page Not Found

25 |
26 | Sorry, but the page you are looking for has note been found. Try checking the URL for error, then hit the refresh button on your browser or try found something else in our app. 27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /templates/restartMautic.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 | 5 |
6 | mautic:重启 PHP 7 |
8 | 9 |
10 |
11 |
12 | 13 | 19 |
20 | 21 | 22 |
23 |
24 | 25 | 35 | {% endblock %} 36 | -------------------------------------------------------------------------------- /users/urls.py: -------------------------------------------------------------------------------- 1 | """mico URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url,include 17 | from users.views import user_list,user_add_html,user_add,user_edit,user_is_active 18 | 19 | urlpatterns = [ 20 | url(r'^user_list/$', user_list, name='user_list'), 21 | url(r'^user_add_html/$', user_add_html, name='user_add_html'), 22 | url(r'^user_add/$', user_add, name='user_add'), 23 | url(r'user_edit/(?P\d+)/$', user_edit, name='user_edit'), 24 | url(r'^user_is_active/(?P\d+)/$', user_is_active, name='user_is_active'), 25 | ] -------------------------------------------------------------------------------- /cache/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-13 13:40 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ('asset', '0001_initial'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='memcache', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('env', models.IntegerField(blank=True, choices=[(1, '\u751f\u4ea7\u73af\u5883'), (2, '\u6d4b\u8bd5\u73af\u5883')], null=True, verbose_name='\u8fd0\u884c\u73af\u5883')), 23 | ('ip', models.GenericIPAddressField()), 24 | ('port', models.CharField(default=b'11211', max_length=32)), 25 | ('memcacheName', models.CharField(max_length=64, unique=True)), 26 | ('saltMinion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='asset.minion')), 27 | ], 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /project_crontab/migrations/0002_auto_20180614_1813.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-14 18:13 3 | from __future__ import unicode_literals 4 | 5 | import datetime 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('project_crontab', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='crontabcmd', 18 | name='create_time', 19 | field=models.DateTimeField(default=datetime.datetime(2018, 6, 14, 18, 13, 49, 598796), verbose_name='\u521b\u5efa\u65e5\u671f'), 20 | ), 21 | migrations.AlterField( 22 | model_name='project', 23 | name='create_time', 24 | field=models.DateTimeField(default=datetime.datetime(2018, 6, 14, 18, 13, 49, 597564), verbose_name='\u521b\u5efa\u65e5\u671f'), 25 | ), 26 | migrations.AlterField( 27 | model_name='svn', 28 | name='create_time', 29 | field=models.DateTimeField(default=datetime.datetime(2018, 6, 14, 18, 13, 49, 596230), verbose_name='\u521b\u5efa\u65e5\u671f'), 30 | ), 31 | ] 32 | -------------------------------------------------------------------------------- /winservices/urls.py: -------------------------------------------------------------------------------- 1 | """mico URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url,include 17 | from django.contrib import admin 18 | from winservices.views import * 19 | 20 | urlpatterns = [ 21 | 22 | url(r'^services/$', services, name='winservices'), 23 | url(r'^getServicesList/$',getServicesList,name='getServicesList'), 24 | url(r'^deployService/$',deployService,name='deployService'), 25 | url(r'^winServicesList/$',winServicesList,name='winServicesList'), 26 | url(r'^winServicesRestart/$', winServicesRestart, name='winServicesRestart'), 27 | 28 | ] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CMDB是一个发布平台,主要有以下功能: 2 | 3 | 4 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/111.png) 5 | 6 | 1.go项目发布 7 | 8 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/112.png) 9 | 10 | 11 | 2.windows services发布 12 | 13 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/113.png) 14 | 15 | 3.windows iis发布 16 | 17 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/114.png) 18 | 19 | 20 | 4.memcache缓存清理 21 | 22 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/115.png) 23 | 24 | 25 | 5.svn创建 26 | 27 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/116.png) 28 | 29 | 6.asset 30 | 31 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/117.png) 32 | 33 | 7.kettle运行 34 | 35 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/118.png) 36 | 37 | 8.工单处理 38 | 39 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/119.png) 40 | 41 | 9.日记统计 42 | 43 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/120.png) 44 | 45 | 46 | 10.后台管理 47 | 48 | ![image](https://github.com/pengzihe/cmdb/blob/master/static/screen/121.png) 49 | 50 | 51 | -------------------------------------------------------------------------------- /project_crontab/migrations/0003_auto_20180614_1816.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-14 18:16 3 | from __future__ import unicode_literals 4 | 5 | import datetime 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('project_crontab', '0002_auto_20180614_1813'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='crontabcmd', 18 | name='create_time', 19 | field=models.DateTimeField(default=datetime.datetime(2018, 6, 14, 18, 16, 55, 301), verbose_name='\u521b\u5efa\u65e5\u671f'), 20 | ), 21 | migrations.AlterField( 22 | model_name='project', 23 | name='create_time', 24 | field=models.DateTimeField(default=datetime.datetime(2018, 6, 14, 18, 16, 54, 999185), verbose_name='\u521b\u5efa\u65e5\u671f'), 25 | ), 26 | migrations.AlterField( 27 | model_name='svn', 28 | name='create_time', 29 | field=models.DateTimeField(default=datetime.datetime(2018, 6, 14, 18, 16, 54, 998035), verbose_name='\u521b\u5efa\u65e5\u671f'), 30 | ), 31 | ] 32 | -------------------------------------------------------------------------------- /web/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,render_to_response,HttpResponseRedirect,HttpResponse,redirect 2 | from django.contrib import auth 3 | from django.contrib.auth.decorators import login_required 4 | from web.models import userLogin 5 | # Create your views here. 6 | 7 | def login(request): 8 | ip = request.META['REMOTE_ADDR'] 9 | if request.method == 'POST': 10 | username = request.POST.get('username') 11 | password = request.POST.get('password') 12 | user = auth.authenticate(username = username,password = password) 13 | if user is not None and user.is_active: 14 | auth.login(request,user) 15 | obj = userLogin.objects.create(username=username,remote_ip=ip) 16 | obj.save() 17 | if request.GET.get('next') != 'None' and request.GET.get('next') != '': 18 | return redirect(request.GET.get('next')) 19 | return HttpResponseRedirect('/') 20 | else: 21 | return render(request,'login.html',{'login_err':'Wrong username or password!'}) 22 | 23 | else: 24 | return render(request,'login.html',{'next':request.GET.get('next')}) 25 | 26 | @login_required 27 | def logout(request): 28 | auth.logout(request) 29 | return HttpResponseRedirect('/login/') -------------------------------------------------------------------------------- /cmdb/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,render_to_response 2 | from django.contrib.auth.decorators import login_required 3 | from django.contrib.auth.models import User 4 | from django.utils.timezone import now, timedelta 5 | from django.db.models import Count 6 | from asset.models import gogroup,Asset 7 | from logs.models import goLog,publishLog 8 | from web.models import userLogin 9 | # Create your views here. 10 | @login_required 11 | def index(request): 12 | users = User.objects.count() 13 | projects = gogroup.objects.count() 14 | start = now().date() 15 | end = start + timedelta(days=1) 16 | build_count = goLog.objects.filter(datetime__range=(start,end)).count() 17 | top_three = goLog.objects.filter(datetime__range=(start,end)).values('user').annotate(count=Count('user')).order_by('-count')[0:3] 18 | hosts_count = Asset.objects.all().count() 19 | user_login_time = userLogin.objects.all().order_by('-login_time')[0:5] 20 | publish_logs = publishLog.objects.filter(datetime__range=(start,end)).order_by('-datetime') 21 | 22 | return render(request,'dashboard.html',{'users':users,'projects':projects, 23 | 'build_count':build_count,'top_three':top_three,'hosts_count':hosts_count, 24 | 'user_login_time':user_login_time,'publish_logs':publish_logs}) -------------------------------------------------------------------------------- /templates/getText.html: -------------------------------------------------------------------------------- 1 | 2 | {% extends 'base.html' %} 3 | {% block content %} 4 | 5 | 6 | 7 |

Result:

8 |

9 |
10 | 11 | 12 | 34 | 35 | {% endblock %} 36 | 37 | -------------------------------------------------------------------------------- /subversion/urls.py: -------------------------------------------------------------------------------- 1 | """mico URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url,include 17 | from django.contrib import admin 18 | from subversion.views import subversionCreate,getSubversionHost,createRepo,subversionAddUserHtml,svnAddUser 19 | 20 | urlpatterns = [ 21 | 22 | url(r'^subversionCreate/$', subversionCreate, name='subversionCreate'), 23 | url(r'^subversionAddUser/$', subversionAddUserHtml, name='subversionAddUserHtml'), 24 | url(r'^getSubversionHost/$', getSubversionHost, name='getSubversionHost'), 25 | url(r'^createRepo/$', createRepo, name='createRepo'), 26 | url(r'^svnAddUser/$', svnAddUser, name='svnAddUser'), 27 | 28 | ] -------------------------------------------------------------------------------- /asset/migrations/0009_gotemplate.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-02-24 11:45 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('asset', '0008_auto_20161220_1431'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='GOTemplate', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('username', models.CharField(max_length=32)), 21 | ('password', models.CharField(max_length=32)), 22 | ('repo', models.CharField(max_length=128)), 23 | ('localpath', models.CharField(max_length=64)), 24 | ('env', models.IntegerField(blank=True, choices=[(1, '\u751f\u4ea7\u73af\u5883'), (2, '\u6d4b\u8bd5\u73af\u5883')], null=True, verbose_name='\u8fd0\u884c\u73af\u5883')), 25 | ('hostname', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='asset.minion')), 26 | ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='asset.gogroup')), 27 | ], 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /winservices/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-13 13:40 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ('asset', '0001_initial'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='winconf', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('username', models.CharField(max_length=32)), 23 | ('password', models.CharField(max_length=32)), 24 | ('repo', models.CharField(max_length=128)), 25 | ('localpath', models.CharField(max_length=64)), 26 | ('env', models.IntegerField(blank=True, choices=[(1, '\u751f\u4ea7\u73af\u5883'), (2, '\u6d4b\u8bd5\u73af\u5883')], null=True, verbose_name='\u8fd0\u884c\u73af\u5883')), 27 | ('servicename', models.CharField(max_length=32)), 28 | ('tasklist_name', models.CharField(max_length=32)), 29 | ('hostname', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='asset.minion')), 30 | ], 31 | ), 32 | ] 33 | -------------------------------------------------------------------------------- /static/js/highcharts/modules/no-data-to-display.js: -------------------------------------------------------------------------------- 1 | /* 2 | Highcharts JS v4.0.1 (2014-04-24) 3 | Plugin for displaying a message when there is no data visible in chart. 4 | 5 | (c) 2010-2014 Highsoft AS 6 | Author: Oystein Moseng 7 | 8 | License: www.highcharts.com/license 9 | */ 10 | (function(c){function f(){return!!this.points.length}function g(){this.hasData()?this.hideNoData():this.showNoData()}var d=c.seriesTypes,e=c.Chart.prototype,h=c.getOptions(),i=c.extend;i(h.lang,{noData:"No data to display"});h.noData={position:{x:0,y:0,align:"center",verticalAlign:"middle"},attr:{},style:{fontWeight:"bold",fontSize:"12px",color:"#60606a"}};if(d.pie)d.pie.prototype.hasData=f;if(d.gauge)d.gauge.prototype.hasData=f;if(d.waterfall)d.waterfall.prototype.hasData=f;c.Series.prototype.hasData= 11 | function(){return this.dataMax!==void 0&&this.dataMin!==void 0};e.showNoData=function(a){var b=this.options,a=a||b.lang.noData,b=b.noData;if(!this.noDataLabel)this.noDataLabel=this.renderer.label(a,0,0,null,null,null,null,null,"no-data").attr(b.attr).css(b.style).add(),this.noDataLabel.align(i(this.noDataLabel.getBBox(),b.position),!1,"plotBox")};e.hideNoData=function(){if(this.noDataLabel)this.noDataLabel=this.noDataLabel.destroy()};e.hasData=function(){for(var a=this.series,b=a.length;b--;)if(a[b].hasData()&& 12 | !a[b].options.isInternal)return!0;return!1};e.callbacks.push(function(a){c.addEvent(a,"load",g);c.addEvent(a,"redraw",g)})})(Highcharts); 13 | -------------------------------------------------------------------------------- /www/models.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | from django.db import models 4 | from asset.models import ASSET_ENV 5 | # Create your models here. 6 | 7 | class salt_module(models.Model): 8 | state_module = models.CharField(max_length=128) 9 | def __unicode__(self): 10 | return self.state_module 11 | 12 | class webUrl(models.Model): 13 | host = models.CharField(max_length=64) 14 | url = models.CharField(max_length=64) 15 | ip = models.GenericIPAddressField() 16 | def __unicode__(self): 17 | return self.url 18 | 19 | class webSite(models.Model): 20 | webSite = models.CharField(max_length=64) 21 | lb_server = models.CharField(max_length=64) 22 | state_module = models.ManyToManyField(salt_module) 23 | salt_pillar_host = models.CharField(max_length=64) 24 | svn_path = models.CharField(max_length=128) 25 | checkUrl = models.ManyToManyField(webUrl) 26 | svn_username = models.CharField(max_length=128) 27 | svn_password = models.CharField(max_length=128) 28 | svn_repo = models.CharField(max_length=128) 29 | recycle_cmd = models.CharField(max_length=128) 30 | env = models.IntegerField(choices=ASSET_ENV,verbose_name=u"运行环境") 31 | 32 | 33 | def __unicode__(self): 34 | return self.webSite 35 | 36 | class groupName(models.Model): 37 | group_name = models.CharField(max_length=64) 38 | member = models.ManyToManyField(webSite) 39 | 40 | def __unicode__(self): 41 | return self.group_name -------------------------------------------------------------------------------- /templates/foot_script.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 41 | -------------------------------------------------------------------------------- /logs/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-13 13:40 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='goLog', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('user', models.CharField(max_length=100)), 21 | ('remote_ip', models.GenericIPAddressField()), 22 | ('goAction', models.TextField()), 23 | ('result', models.TextField(default='')), 24 | ('datetime', models.DateTimeField(auto_now=True)), 25 | ], 26 | ), 27 | migrations.CreateModel( 28 | name='publishLog', 29 | fields=[ 30 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 31 | ('user', models.CharField(max_length=100)), 32 | ('remote_ip', models.GenericIPAddressField()), 33 | ('publish_url', models.TextField(default='')), 34 | ('publish_result', models.TextField(default='')), 35 | ('datetime', models.DateTimeField(auto_now=True)), 36 | ], 37 | ), 38 | ] 39 | -------------------------------------------------------------------------------- /config_center/migrations/0001_initial.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | -- 3 | -- Create model Resources 4 | -- 5 | CREATE TABLE `config_center_resources` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(128) NOT NULL, `category` varchar(16) NOT NULL, `comment` varchar(256) NOT NULL); 6 | -- 7 | -- Create model ResTypes 8 | -- 9 | CREATE TABLE `config_center_restypes` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(32) NOT NULL); 10 | -- 11 | -- Create model SVCResources 12 | -- 13 | CREATE TABLE `config_center_svcresources` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `res_id` integer NOT NULL, `svc_id` integer NOT NULL); 14 | -- 15 | -- Add field type to resources 16 | -- 17 | ALTER TABLE `config_center_resources` ADD COLUMN `type_id` integer NOT NULL; 18 | ALTER TABLE `config_center_resources` ALTER COLUMN `type_id` DROP DEFAULT; 19 | ALTER TABLE `config_center_svcresources` ADD CONSTRAINT `config_center_svcr_res_id_34001e34_fk_config_center_resources_id` FOREIGN KEY (`res_id`) REFERENCES `config_center_resources` (`id`); 20 | ALTER TABLE `config_center_svcresources` ADD CONSTRAINT `config_center_svcresources_svc_id_2a8df2bc_fk_asset_gogroup_id` FOREIGN KEY (`svc_id`) REFERENCES `asset_gogroup` (`id`); 21 | CREATE INDEX `config_center_resources_94757cae` ON `config_center_resources` (`type_id`); 22 | ALTER TABLE `config_center_resources` ADD CONSTRAINT `config_center_reso_type_id_7c82abd5_fk_config_center_restypes_id` FOREIGN KEY (`type_id`) REFERENCES `config_center_restypes` (`id`); 23 | 24 | COMMIT; 25 | -------------------------------------------------------------------------------- /workflow/urls.py: -------------------------------------------------------------------------------- 1 | """mico URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url,include 17 | from django.contrib import admin 18 | from workflow.views import index,get_hosts,my_tickets,get_ticket_tasks,submit_tickets,handle_tickets,handled_tasks 19 | from workflow.views import get_svc_minions 20 | 21 | 22 | urlpatterns = [ 23 | url(r'^index/$', index, name='workflow_index'), 24 | url(r'^get_hosts/$', get_hosts, name='get_hosts'), 25 | url(r'^my_tickets/$', my_tickets, name='my_tickets'), 26 | url(r'^get_ticket_tasks/$', get_ticket_tasks, name='get_ticket_tasks'), 27 | url(r'^submit_tickets/$', submit_tickets, name='submit_tickets'), 28 | url(r'^handle_tickets/$', handle_tickets, name='handle_tickets'), 29 | url(r'^handled_tasks/$', handled_tasks, name='handled_tasks'), 30 | url(r'^svc_minions/$', get_svc_minions, name='get_svc_minions'), 31 | ] -------------------------------------------------------------------------------- /static/js/highcharts/themes/grid-light.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Grid-light theme for Highcharts JS 3 | * @author Torstein Honsi 4 | */ 5 | 6 | // Load the fonts 7 | Highcharts.createElement('link', { 8 | href: 'http://fonts.googleapis.com/css?family=Dosis:400,600', 9 | rel: 'stylesheet', 10 | type: 'text/css' 11 | }, null, document.getElementsByTagName('head')[0]); 12 | 13 | Highcharts.theme = { 14 | colors: ["#7cb5ec", "#f7a35c", "#90ee7e", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", 15 | "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], 16 | chart: { 17 | backgroundColor: null, 18 | style: { 19 | fontFamily: "Dosis, sans-serif" 20 | } 21 | }, 22 | title: { 23 | style: { 24 | fontSize: '16px', 25 | fontWeight: 'bold', 26 | textTransform: 'uppercase' 27 | } 28 | }, 29 | tooltip: { 30 | borderWidth: 0, 31 | backgroundColor: 'rgba(219,219,216,0.8)', 32 | shadow: false 33 | }, 34 | legend: { 35 | itemStyle: { 36 | fontWeight: 'bold', 37 | fontSize: '13px' 38 | } 39 | }, 40 | xAxis: { 41 | gridLineWidth: 1, 42 | labels: { 43 | style: { 44 | fontSize: '12px' 45 | } 46 | } 47 | }, 48 | yAxis: { 49 | minorTickInterval: 'auto', 50 | title: { 51 | style: { 52 | textTransform: 'uppercase' 53 | } 54 | }, 55 | labels: { 56 | style: { 57 | fontSize: '12px' 58 | } 59 | } 60 | }, 61 | plotOptions: { 62 | candlestick: { 63 | lineColor: '#404048' 64 | } 65 | }, 66 | 67 | 68 | // General 69 | background2: '#F0F0EA' 70 | 71 | }; 72 | 73 | // Apply the theme 74 | Highcharts.setOptions(Highcharts.theme); 75 | -------------------------------------------------------------------------------- /config_center/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.decorators import login_required 2 | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger 3 | from django.shortcuts import render 4 | 5 | from asset.models import gogroup 6 | from asset.utils import goServicesni 7 | from config_center.models import SVCResources, Resources 8 | 9 | 10 | # Create your views here. 11 | @login_required 12 | def service_list(request): 13 | project_name = request.GET.get('projectName') 14 | go = goServicesni(project_name) 15 | group_name = gogroup.objects.all() 16 | services_list = go.getServiceName() 17 | paginator = Paginator(services_list, 20) 18 | page = request.GET.get('page') 19 | 20 | try: 21 | contacts = paginator.page(page) 22 | except PageNotAnInteger: 23 | contacts = paginator.page(1) 24 | except EmptyPage: 25 | contacts = paginator.page(paginator.num_pages) 26 | 27 | q = SVCResources.objects.filter(svc__name=project_name).all() 28 | 29 | return render(request, 'service_list.html', 30 | dict(project=contacts, groupName=group_name, project_name=project_name, svc_res=q)) 31 | 32 | 33 | @login_required 34 | def resource_list(request): 35 | res_name = request.GET.get('res_name') 36 | res_obj = Resources.objects.filter(name=res_name).first() 37 | res_list = Resources.objects.all() 38 | 39 | q = SVCResources.objects.filter(res__name=res_name).all() 40 | 41 | return render(request, 'resource_list.html', 42 | dict(res_list=res_list, res_obj=res_obj, svc_res=q)) 43 | -------------------------------------------------------------------------------- /templates/commandIndex.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 | 5 |
6 | 说明 7 |

8 | 仅支持CMDB中现有的Go服务,参数可自定义,比如:spike service elastic
9 | 系统会从SVN拉取最新的 gotemplate 和 可执行文件,实际执行的命令会补全,比如:/srv/spike/spike service elastic -c /srv/gotemplate/spike/conf.ctmpl
10 | 另外,命令中不允许包含 ; && || 等字符。 11 |

12 |
13 | 14 |
15 |
16 |
17 | 18 | 23 |
24 | 25 |
26 | 27 | 28 |
29 | 30 | 31 |
32 |
33 | 34 | 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /alert/urls.py: -------------------------------------------------------------------------------- 1 | """URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url 17 | 18 | from alert.views import * 19 | 20 | urlpatterns = [ 21 | url(r'^index/$', project_view), 22 | url(r'^projects/$', project_view, name='project_view'), 23 | url(r'^projects/add/$', project_add, name='project_add'), 24 | url(r'^projects/edit/$', project_edit, name='project_edit'), 25 | url(r'^projects/remove/$', project_remove, name='project_remove'), 26 | url(r'^items/$', item_view, name='item_view'), 27 | url(r'^items/add/$', item_add, name='item_add'), 28 | url(r'^items/edit/$', item_edit, name='item_edit'), 29 | url(r'^items/remove/$', item_remove, name='item_remove'), 30 | url(r'^items/history/$', item_history, name='item_history'), 31 | url(r'^find_metrics/$', find_metrics, name='find_metrics'), 32 | url(r'^search_user/$', search_user, name='search_user'), 33 | url(r'^search_metrics/$', search_metrics, name='search_metrics'), 34 | ] 35 | -------------------------------------------------------------------------------- /kettle/utils.py: -------------------------------------------------------------------------------- 1 | from celery.task import task 2 | from salt_api.api import SaltApi 3 | from mico.settings import kettle_host,kettle_install_dir,kettle_svn_path,kettle_log_path 4 | from asset.utils import logs,dingding_robo 5 | 6 | 7 | @task 8 | def kettle_run(user,ip,cmd_type,file_path,kettle_log_file,phone_number): 9 | salt_api = SaltApi() 10 | file_path = kettle_svn_path + file_path 11 | kettle_log_file = kettle_log_path + kettle_log_file 12 | 13 | if int(cmd_type) == 1: 14 | cmd = '%span.sh -file %s -logfile %s' % (kettle_install_dir,file_path,kettle_log_file) 15 | elif int(cmd_type) == 2: 16 | cmd = '%skitchen.sh -file %s -logfile %s' % (kettle_install_dir,file_path,kettle_log_file) 17 | 18 | exists_file_cmd = 'ls %s' % file_path 19 | exists_file = { 20 | 'client': 'local', 21 | 'tgt': kettle_host, 22 | 'fun': 'cmd.run', 23 | 'arg': exists_file_cmd 24 | } 25 | 26 | file_result = salt_api.salt_cmd(exists_file) 27 | if file_result['return'][0][kettle_host] != file_path: 28 | logs(user,ip,cmd,'not %s file.' % file_path) 29 | dingding_robo(kettle_host,'kettle job','it is error',user,phone_number) 30 | return 0 31 | 32 | data = { 33 | 'client': 'local', 34 | 'tgt': kettle_host, 35 | 'fun': 'cmd.run', 36 | 'arg': cmd 37 | } 38 | 39 | result = salt_api.salt_cmd(data) 40 | if result != 0: 41 | result = result['return'] 42 | 43 | logs(user,ip,cmd,'running') 44 | dingding_robo(kettle_host,'kettle job',result,user,phone_number) 45 | return result 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /project_crontab/models.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | from django.db import models 4 | from django.contrib.auth.models import User 5 | 6 | from asset.models import minion, crontab_svn 7 | 8 | 9 | class CrontabCmd(models.Model): 10 | """ 11 | crontab命令信息 12 | """ 13 | STATUS = ( 14 | (1, U'暂停中'), 15 | (2, U'运行中'), 16 | ) 17 | svn = models.ForeignKey(crontab_svn, verbose_name=u"Crontab所属SVN", related_name="svn_of_crontab") 18 | cmd = models.TextField(verbose_name=u"手动填入的命令", blank=False, null=False) 19 | auto_cmd = models.TextField(verbose_name=u"自动补全的命令", blank=False, null=False) 20 | frequency = models.CharField(max_length=16, verbose_name=u"执行频率", blank=False, null=False) 21 | cmd_status = models.IntegerField(choices=STATUS, default=1, verbose_name=u"状态") 22 | creator = models.ForeignKey(User, verbose_name=u"创建者", related_name="creator_of_crontab", default=1) 23 | create_time = models.DateTimeField(verbose_name=u"创建日期", auto_now_add=True, null=True, blank=True) 24 | updater = models.ForeignKey(User, verbose_name=u"最后更新者", related_name="updater_of_crontab", blank=True, null=True) 25 | update_time = models.DateTimeField(verbose_name=u"最后更新日期", auto_now=True, blank=True, null=True) 26 | last_run_result = models.CharField(max_length=16, verbose_name=u"上次执行结果", blank=True, null=True) 27 | last_run_time = models.DateTimeField(verbose_name=u"上次执行时间", blank=True, null=True) 28 | 29 | def __unicode__(self): 30 | return self.svn.project, self.auto_cmd, self.frequency 31 | 32 | class Meta: 33 | verbose_name = u"crontab命令" 34 | verbose_name_plural = verbose_name 35 | -------------------------------------------------------------------------------- /templates/kettleIndex.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 | 5 | 6 |
7 |
8 |
9 | 10 | 15 |
16 | 17 |
18 | 19 | 21 |
22 | 23 |
24 | 25 | 27 |
28 | 29 | 30 |
31 | 32 | 33 | 44 | {% endblock %} 45 | 46 | -------------------------------------------------------------------------------- /static/css/plugins/iCheck/custom.css: -------------------------------------------------------------------------------- 1 | /* iCheck plugin Square skin, green 2 | ----------------------------------- */ 3 | .icheckbox_square-green, 4 | .iradio_square-green { 5 | display: inline-block; 6 | *display: inline; 7 | vertical-align: middle; 8 | margin: 0; 9 | padding: 0; 10 | width: 22px; 11 | height: 22px; 12 | background: url(green.png) no-repeat; 13 | border: none; 14 | cursor: pointer; 15 | } 16 | 17 | .icheckbox_square-green { 18 | background-position: 0 0; 19 | } 20 | .icheckbox_square-green.hover { 21 | background-position: -24px 0; 22 | } 23 | .icheckbox_square-green.checked { 24 | background-position: -48px 0; 25 | } 26 | .icheckbox_square-green.disabled { 27 | background-position: -72px 0; 28 | cursor: default; 29 | } 30 | .icheckbox_square-green.checked.disabled { 31 | background-position: -96px 0; 32 | } 33 | 34 | .iradio_square-green { 35 | background-position: -120px 0; 36 | } 37 | .iradio_square-green.hover { 38 | background-position: -144px 0; 39 | } 40 | .iradio_square-green.checked { 41 | background-position: -168px 0; 42 | } 43 | .iradio_square-green.disabled { 44 | background-position: -192px 0; 45 | cursor: default; 46 | } 47 | .iradio_square-green.checked.disabled { 48 | background-position: -216px 0; 49 | } 50 | 51 | /* HiDPI support */ 52 | @media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) { 53 | .icheckbox_square-green, 54 | .iradio_square-green { 55 | background-image: url(green@2x.png); 56 | -webkit-background-size: 240px 24px; 57 | background-size: 240px 24px; 58 | } 59 | } -------------------------------------------------------------------------------- /templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ezbuy | 500 Error 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |

Error

24 |

{{ message }}

25 |

26 |
27 | The server encountered something unexpected that didn't allow it to complete the request. We apologize.
28 | You can go back to main page:
首页 29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /cache/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,render_to_response,HttpResponse 2 | from django.contrib.auth.decorators import login_required 3 | from asset.utils import logs,dingding_robo,deny_resubmit 4 | from salt.client import LocalClient 5 | from cache.models import memcache 6 | # Create your views here. 7 | 8 | 9 | @login_required 10 | @deny_resubmit(page_key='memcache') 11 | def memcached(request): 12 | if 'env' in request.GET: 13 | env = request.GET['env'] 14 | else: 15 | env = 1 16 | mc = memcache.objects.filter(env=env) 17 | 18 | 19 | return render(request,"memcachelist.html",{'project':mc}) 20 | 21 | 22 | @login_required 23 | @deny_resubmit(page_key='memcache') 24 | def flushMemcached(request): 25 | data = request.POST.getlist('mcName') 26 | project = 'memcache flush' 27 | username = request.user 28 | ip = request.META['REMOTE_ADDR'] 29 | saltCmd = LocalClient() 30 | result = [] 31 | 32 | for name in data: 33 | for info in memcache.objects.filter(memcacheName=name): 34 | try: 35 | cmd = saltCmd.cmd(info.saltMinion.saltname,'cmd.run',['echo "flush_all" | nc %s %s' % (info.ip,info.port)]) 36 | result.append(cmd) 37 | if cmd[info.saltMinion.saltname] == 'OK': 38 | msg = 'Success' 39 | else: 40 | msg = 'error' 41 | host = info.ip + ":" + info.port 42 | dingding_robo(host,project,msg,username,request.POST['phone_number']) 43 | print result 44 | except Exception,e: 45 | print e 46 | logs(username,ip,project,result) 47 | 48 | return render(request,'getdata.html',{'result':result}) 49 | -------------------------------------------------------------------------------- /salt_api/api.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import json 3 | import yaml 4 | from mico.settings import salt_api_url,salt_user,salt_password,salt_api_url2,salt_location 5 | 6 | class SaltApi(object): 7 | def __init__(self,location='local'): 8 | print '------location:',location 9 | if location == salt_location: 10 | self.__loginUrl = salt_api_url2 + '/login' 11 | self.__url = salt_api_url2 12 | else: 13 | self.__loginUrl = salt_api_url + '/login' 14 | self.__url = salt_api_url 15 | self.__username = salt_user 16 | self.__password = salt_password 17 | 18 | 19 | 20 | def salt_login(self): 21 | params = {'eauth': 'pam', 22 | 'username': self.__username, 23 | 'password': self.__password 24 | } 25 | headers = {'Accept': 'application/json'} 26 | obj = requests.post(self.__loginUrl,headers=headers,data=params,verify=False).content 27 | data = json.loads(obj) 28 | token = data['return'][0]['token'] 29 | return token 30 | 31 | def salt_cmd(self,data): 32 | self.data = data 33 | self.__token_id = self.salt_login() 34 | headers = {'Accept': 'application/x-yaml', 35 | 'X-Auth-Token': '%s' % self.__token_id 36 | } 37 | obj = requests.post(self.__url,headers=headers,data=self.data,verify=False) 38 | print 'salt_cmd---obj : ' 39 | print obj 40 | obj = obj.content 41 | print 'salt_cmd---obj.content : ' 42 | print obj 43 | try: 44 | print 'salt_cmd---yaml.load(obj) : ' 45 | print yaml.load(obj) 46 | return yaml.load(obj) 47 | except Exception, e: 48 | print 'salt_cmd---Exception : ' 49 | print e 50 | return 0 51 | -------------------------------------------------------------------------------- /templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 登录 | CMDBServer 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |
19 |

20 |
21 | 22 |

Welcome to CMDBServer

23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 | 31 |

{{ login_err }}

32 | 33 | 34 |
35 |

Copyright ezbuy Organization © 2016

36 |
37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .idea/ 3 | .vscode 4 | 5 | # Created by https://www.gitignore.io/api/python 6 | 7 | ### Python ### 8 | # Byte-compiled / optimized / DLL files 9 | __pycache__/ 10 | *.py[cod] 11 | *$py.class 12 | 13 | # C extensions 14 | *.so 15 | 16 | # Distribution / packaging 17 | .Python 18 | build/ 19 | develop-eggs/ 20 | dist/ 21 | downloads/ 22 | eggs/ 23 | .eggs/ 24 | lib/ 25 | lib64/ 26 | parts/ 27 | sdist/ 28 | var/ 29 | wheels/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | 34 | # PyInstaller 35 | # Usually these files are written by a python script from a template 36 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 37 | *.manifest 38 | *.spec 39 | 40 | # Installer logs 41 | pip-log.txt 42 | pip-delete-this-directory.txt 43 | 44 | # Unit test / coverage reports 45 | htmlcov/ 46 | .tox/ 47 | .coverage 48 | .coverage.* 49 | .cache 50 | .pytest_cache/ 51 | nosetests.xml 52 | coverage.xml 53 | *.cover 54 | .hypothesis/ 55 | 56 | # Translations 57 | *.mo 58 | *.pot 59 | 60 | # Flask stuff: 61 | instance/ 62 | .webassets-cache 63 | 64 | # Scrapy stuff: 65 | .scrapy 66 | 67 | # Sphinx documentation 68 | docs/_build/ 69 | 70 | # PyBuilder 71 | target/ 72 | 73 | # Jupyter Notebook 74 | .ipynb_checkpoints 75 | 76 | # pyenv 77 | .python-version 78 | 79 | # celery beat schedule file 80 | celerybeat-schedule.* 81 | 82 | # SageMath parsed files 83 | *.sage.py 84 | 85 | # Environments 86 | .env 87 | .venv 88 | env/ 89 | venv/ 90 | ENV/ 91 | env.bak/ 92 | venv.bak/ 93 | 94 | # Spyder project settings 95 | .spyderproject 96 | .spyproject 97 | 98 | # Rope project settings 99 | .ropeproject 100 | 101 | # mkdocs documentation 102 | /site 103 | 104 | # mypy 105 | .mypy_cache/ 106 | 107 | 108 | # End of https://www.gitignore.io/api/python 109 | -------------------------------------------------------------------------------- /mico/urls.py: -------------------------------------------------------------------------------- 1 | """mico URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url, include 17 | from django.contrib import admin 18 | from cmdb.views import index 19 | from web.views import login, logout 20 | 21 | import asset, logs, winservices, cache, www, subversion, kettle, workflow, users, project_crontab 22 | import disque 23 | 24 | urlpatterns = [ 25 | url(r'^admin/', admin.site.urls), 26 | url(r'^$', index, name='index'), 27 | url(r'^asset/', include('asset.urls')), 28 | url(r'^logs/', include('logs.urls')), 29 | url(r'^winservices/', include('winservices.urls')), 30 | url(r'^cache/', include('cache.urls')), 31 | url(r'^www/', include('www.urls')), 32 | url(r'^login/', login, name='login'), 33 | url(r'^logout/', logout, name='logout'), 34 | url(r'^subversion/', include('subversion.urls')), 35 | url(r'^kettle/', include('kettle.urls')), 36 | url(r'^workflow/', include('workflow.urls')), 37 | url(r'^alert/', include('alert.urls')), 38 | url(r'^users/', include('users.urls')), 39 | url(r'^configcenter/', include('config_center.urls')), 40 | url(r'^command/', include('command_job.urls')), 41 | url(r'^consul_kv/', include('consul_kv.urls')), 42 | url(r'^disque/', include('disque.urls')), 43 | url(r'^asset/', include('project_crontab.urls')), 44 | ] 45 | -------------------------------------------------------------------------------- /winservices/views.py: -------------------------------------------------------------------------------- 1 | 2 | from django.shortcuts import render,render_to_response,HttpResponse 3 | from django.contrib.auth.decorators import login_required 4 | # Create your views here. 5 | from winservices.models import winconf 6 | import json 7 | from winservices.utils import servicesPublish 8 | from winservices.models import winconf 9 | from salt.client import LocalClient 10 | from asset.utils import logs,deny_resubmit 11 | 12 | 13 | @login_required 14 | @deny_resubmit(page_key='deploy_winservices') 15 | def services(request): 16 | return render(request,'winservices.html') 17 | 18 | 19 | @login_required 20 | def getServicesList(request): 21 | env = request.GET['env'] 22 | obj = winconf.objects.filter(env=env) 23 | servicesList = [] 24 | for name in obj: 25 | servicesList.append(name.servicename) 26 | 27 | return HttpResponse(json.dumps(servicesList)) 28 | 29 | @login_required 30 | @deny_resubmit(page_key='deploy_winservices') 31 | def deployService(request): 32 | username = request.user 33 | ip = request.META['REMOTE_ADDR'] 34 | env = request.POST['env'] 35 | server = request.POST['services'] 36 | 37 | obj = servicesPublish(username,ip).deployServices(env,server,request.POST['phone_number']) 38 | return render(request,'getdata.html',{'result':obj}) 39 | 40 | @login_required 41 | @deny_resubmit(page_key='deploy_restartservices') 42 | def winServicesList(request): 43 | 44 | if 'env' in request.GET: 45 | env = request.GET['env'] 46 | else: 47 | env = 1 48 | winServices = winconf.objects.filter(env=int(env)) 49 | return render(request,'winserviceslist.html',{'project':winServices}) 50 | 51 | @login_required 52 | @deny_resubmit(page_key='deploy_restartservices') 53 | def winServicesRestart(request): 54 | data = request.POST.getlist('id') 55 | action = request.POST['action'] 56 | username = request.user 57 | ip = request.META['REMOTE_ADDR'] 58 | 59 | result = servicesPublish(username,ip).servicesAction(data,action,request.POST['phone_number']) 60 | 61 | return render(request,'getdata.html',{'result':result}) 62 | -------------------------------------------------------------------------------- /templates/nav_li_profile.html: -------------------------------------------------------------------------------- 1 | {% load mytags %} 2 | 36 | 52 | 53 | -------------------------------------------------------------------------------- /static/js/highcharts/themes/skies.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Skies theme for Highcharts JS 3 | * @author Torstein Honsi 4 | */ 5 | 6 | Highcharts.theme = { 7 | colors: ["#514F78", "#42A07B", "#9B5E4A", "#72727F", "#1F949A", "#82914E", "#86777F", "#42A07B"], 8 | chart: { 9 | className: 'skies', 10 | borderWidth: 0, 11 | plotShadow: true, 12 | plotBackgroundImage: 'http://www.highcharts.com/demo/gfx/skies.jpg', 13 | plotBackgroundColor: { 14 | linearGradient: [0, 0, 250, 500], 15 | stops: [ 16 | [0, 'rgba(255, 255, 255, 1)'], 17 | [1, 'rgba(255, 255, 255, 0)'] 18 | ] 19 | }, 20 | plotBorderWidth: 1 21 | }, 22 | title: { 23 | style: { 24 | color: '#3E576F', 25 | font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' 26 | } 27 | }, 28 | subtitle: { 29 | style: { 30 | color: '#6D869F', 31 | font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' 32 | } 33 | }, 34 | xAxis: { 35 | gridLineWidth: 0, 36 | lineColor: '#C0D0E0', 37 | tickColor: '#C0D0E0', 38 | labels: { 39 | style: { 40 | color: '#666', 41 | fontWeight: 'bold' 42 | } 43 | }, 44 | title: { 45 | style: { 46 | color: '#666', 47 | font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' 48 | } 49 | } 50 | }, 51 | yAxis: { 52 | alternateGridColor: 'rgba(255, 255, 255, .5)', 53 | lineColor: '#C0D0E0', 54 | tickColor: '#C0D0E0', 55 | tickWidth: 1, 56 | labels: { 57 | style: { 58 | color: '#666', 59 | fontWeight: 'bold' 60 | } 61 | }, 62 | title: { 63 | style: { 64 | color: '#666', 65 | font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' 66 | } 67 | } 68 | }, 69 | legend: { 70 | itemStyle: { 71 | font: '9pt Trebuchet MS, Verdana, sans-serif', 72 | color: '#3E576F' 73 | }, 74 | itemHoverStyle: { 75 | color: 'black' 76 | }, 77 | itemHiddenStyle: { 78 | color: 'silver' 79 | } 80 | }, 81 | labels: { 82 | style: { 83 | color: '#3E576F' 84 | } 85 | } 86 | }; 87 | 88 | // Apply the theme 89 | var highchartsOptions = Highcharts.setOptions(Highcharts.theme); 90 | -------------------------------------------------------------------------------- /config_center/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9 on 2018-06-13 13:40 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ('asset', '0001_initial'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Resources', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('name', models.CharField(max_length=128, verbose_name='\u8d44\u6e90\u552f\u4e00\u6807\u8bc6')), 23 | ('category', models.CharField(choices=[('db', 'db'), ('ops', 'ops')], max_length=16, verbose_name='\u6240\u5c5e\u7c7b\u522b')), 24 | ('comment', models.CharField(default='', max_length=256, verbose_name='\u8d44\u6e90\u8bf4\u660e')), 25 | ], 26 | ), 27 | migrations.CreateModel( 28 | name='ResTypes', 29 | fields=[ 30 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 31 | ('name', models.CharField(default='mysql', max_length=32, verbose_name='\u8d44\u6e90\u7c7b\u578b')), 32 | ], 33 | ), 34 | migrations.CreateModel( 35 | name='SVCResources', 36 | fields=[ 37 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 38 | ('res', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='config_center.Resources')), 39 | ('svc', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='asset.gogroup')), 40 | ], 41 | ), 42 | migrations.AddField( 43 | model_name='resources', 44 | name='type', 45 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='config_center.ResTypes', verbose_name='\u8d44\u6e90\u7c7b\u578b'), 46 | ), 47 | ] 48 | -------------------------------------------------------------------------------- /static/js/highcharts/themes/sand-signika.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sand-Signika theme for Highcharts JS 3 | * @author Torstein Honsi 4 | */ 5 | 6 | // Load the fonts 7 | Highcharts.createElement('link', { 8 | href: 'http://fonts.googleapis.com/css?family=Signika:400,700', 9 | rel: 'stylesheet', 10 | type: 'text/css' 11 | }, null, document.getElementsByTagName('head')[0]); 12 | 13 | // Add the background image to the container 14 | Highcharts.wrap(Highcharts.Chart.prototype, 'getContainer', function (proceed) { 15 | proceed.call(this); 16 | this.container.style.background = 'url(http://www.highcharts.com/samples/graphics/sand.png)'; 17 | }); 18 | 19 | 20 | Highcharts.theme = { 21 | colors: ["#f45b5b", "#8085e9", "#8d4654", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", 22 | "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], 23 | chart: { 24 | backgroundColor: null, 25 | style: { 26 | fontFamily: "Signika, serif" 27 | } 28 | }, 29 | title: { 30 | style: { 31 | color: 'black', 32 | fontSize: '16px', 33 | fontWeight: 'bold' 34 | } 35 | }, 36 | subtitle: { 37 | style: { 38 | color: 'black' 39 | } 40 | }, 41 | tooltip: { 42 | borderWidth: 0 43 | }, 44 | legend: { 45 | itemStyle: { 46 | fontWeight: 'bold', 47 | fontSize: '13px' 48 | } 49 | }, 50 | xAxis: { 51 | labels: { 52 | style: { 53 | color: '#6e6e70' 54 | } 55 | } 56 | }, 57 | yAxis: { 58 | labels: { 59 | style: { 60 | color: '#6e6e70' 61 | } 62 | } 63 | }, 64 | plotOptions: { 65 | series: { 66 | shadow: true 67 | }, 68 | candlestick: { 69 | lineColor: '#404048' 70 | } 71 | }, 72 | 73 | // Highstock specific 74 | navigator: { 75 | xAxis: { 76 | gridLineColor: '#D0D0D8' 77 | } 78 | }, 79 | rangeSelector: { 80 | buttonTheme: { 81 | fill: 'white', 82 | stroke: '#C0C0C8', 83 | 'stroke-width': 1, 84 | states: { 85 | select: { 86 | fill: '#D0D0D8' 87 | } 88 | } 89 | } 90 | }, 91 | scrollbar: { 92 | trackBorderColor: '#C0C0C8' 93 | }, 94 | 95 | // General 96 | background2: '#E0E0E8' 97 | 98 | }; 99 | 100 | // Apply the theme 101 | Highcharts.setOptions(Highcharts.theme); 102 | -------------------------------------------------------------------------------- /static/js/highcharts/modules/funnel.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Highcharts funnel module 4 | 5 | (c) 2010-2014 Torstein Honsi 6 | 7 | License: www.highcharts.com/license 8 | */ 9 | (function(b){var d=b.getOptions(),v=d.plotOptions,q=b.seriesTypes,E=b.merge,D=function(){},A=b.each;v.funnel=E(v.pie,{animation:!1,center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",reversed:!1,dataLabels:{connectorWidth:1,connectorColor:"#606060"},size:!0,states:{select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}}});q.funnel=b.extendClass(q.pie,{type:"funnel",animate:D,singularTooltips:!0,translate:function(){var a=function(j,a){return/%$/.test(j)?a*parseInt(j, 10 | 10)/100:parseInt(j,10)},B=0,f=this.chart,c=this.options,g=c.reversed,b=f.plotWidth,n=f.plotHeight,o=0,f=c.center,h=a(f[0],b),d=a(f[0],n),q=a(c.width,b),k,r,e=a(c.height,n),s=a(c.neckWidth,b),t=a(c.neckHeight,n),w=e-t,a=this.data,x,y,v=c.dataLabels.position==="left"?1:0,z,l,C,p,i,u,m;this.getWidthAt=r=function(j){return j>e-t||e===t?s:s+(q-s)*((e-t-j)/(e-t))};this.getX=function(j,a){return h+(a?-1:1)*(r(g?n-j:j)/2+c.dataLabels.distance)};this.center=[h,d,e];this.centerX=h;A(a,function(a){B+=a.y}); 11 | A(a,function(a){m=null;y=B?a.y/B:0;l=d-e/2+o*e;i=l+y*e;k=r(l);z=h-k/2;C=z+k;k=r(i);p=h-k/2;u=p+k;l>w?(z=p=h-s/2,C=u=h+s/2):i>w&&(m=i,k=r(w),p=h-k/2,u=p+k,i=w);g&&(l=e-l,i=e-i,m=m?e-m:null);x=["M",z,l,"L",C,l,u,i];m&&x.push(u,m,p,m);x.push(p,i,"Z");a.shapeType="path";a.shapeArgs={d:x};a.percentage=y*100;a.plotX=h;a.plotY=(l+(m||i))/2;a.tooltipPos=[h,a.plotY];a.slice=D;a.half=v;o+=y})},drawPoints:function(){var a=this,b=a.options,f=a.chart.renderer;A(a.data,function(c){var g=c.graphic,d=c.shapeArgs; 12 | g?g.animate(d):c.graphic=f.path(d).attr({fill:c.color,stroke:b.borderColor,"stroke-width":b.borderWidth}).add(a.group)})},sortByAngle:function(a){a.sort(function(a,b){return a.plotY-b.plotY})},drawDataLabels:function(){var a=this.data,b=this.options.dataLabels.distance,f,c,g,d=a.length,n,o;for(this.center[2]-=2*b;d--;)g=a[d],c=(f=g.half)?1:-1,o=g.plotY,n=this.getX(o,f),g.labelPos=[0,o,n+(b-5)*c,o,n+b*c,o,f?"right":"left",0];q.pie.prototype.drawDataLabels.call(this)}});d.plotOptions.pyramid=b.merge(d.plotOptions.funnel, 13 | {neckWidth:"0%",neckHeight:"0%",reversed:!0});b.seriesTypes.pyramid=b.extendClass(b.seriesTypes.funnel,{type:"pyramid"})})(Highcharts); 14 | -------------------------------------------------------------------------------- /templates/test.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 |
5 |
6 | 7 | 8 | 9 | 14 |
15 | 16 |
17 | 18 | 19 | 20 | 24 |
25 | 26 |
27 | 28 | 29 | 30 | 33 | 34 |
35 | 36 |
37 | 38 |
39 | 40 | 62 | {% endblock %} 63 | -------------------------------------------------------------------------------- /static/js/highcharts/themes/grid.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Grid theme for Highcharts JS 3 | * @author Torstein Honsi 4 | */ 5 | 6 | Highcharts.theme = { 7 | colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'], 8 | chart: { 9 | backgroundColor: { 10 | linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, 11 | stops: [ 12 | [0, 'rgb(255, 255, 255)'], 13 | [1, 'rgb(240, 240, 255)'] 14 | ] 15 | }, 16 | borderWidth: 2, 17 | plotBackgroundColor: 'rgba(255, 255, 255, .9)', 18 | plotShadow: true, 19 | plotBorderWidth: 1 20 | }, 21 | title: { 22 | style: { 23 | color: '#000', 24 | font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' 25 | } 26 | }, 27 | subtitle: { 28 | style: { 29 | color: '#666666', 30 | font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' 31 | } 32 | }, 33 | xAxis: { 34 | gridLineWidth: 1, 35 | lineColor: '#000', 36 | tickColor: '#000', 37 | labels: { 38 | style: { 39 | color: '#000', 40 | font: '11px Trebuchet MS, Verdana, sans-serif' 41 | } 42 | }, 43 | title: { 44 | style: { 45 | color: '#333', 46 | fontWeight: 'bold', 47 | fontSize: '12px', 48 | fontFamily: 'Trebuchet MS, Verdana, sans-serif' 49 | 50 | } 51 | } 52 | }, 53 | yAxis: { 54 | minorTickInterval: 'auto', 55 | lineColor: '#000', 56 | lineWidth: 1, 57 | tickWidth: 1, 58 | tickColor: '#000', 59 | labels: { 60 | style: { 61 | color: '#000', 62 | font: '11px Trebuchet MS, Verdana, sans-serif' 63 | } 64 | }, 65 | title: { 66 | style: { 67 | color: '#333', 68 | fontWeight: 'bold', 69 | fontSize: '12px', 70 | fontFamily: 'Trebuchet MS, Verdana, sans-serif' 71 | } 72 | } 73 | }, 74 | legend: { 75 | itemStyle: { 76 | font: '9pt Trebuchet MS, Verdana, sans-serif', 77 | color: 'black' 78 | 79 | }, 80 | itemHoverStyle: { 81 | color: '#039' 82 | }, 83 | itemHiddenStyle: { 84 | color: 'gray' 85 | } 86 | }, 87 | labels: { 88 | style: { 89 | color: '#99b' 90 | } 91 | }, 92 | 93 | navigation: { 94 | buttonOptions: { 95 | theme: { 96 | stroke: '#CCCCCC' 97 | } 98 | } 99 | } 100 | }; 101 | 102 | // Apply the theme 103 | var highchartsOptions = Highcharts.setOptions(Highcharts.theme); 104 | -------------------------------------------------------------------------------- /templates/wwwList.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 | 5 | 6 |
7 |
8 |
9 | 10 | 11 | 12 | 17 |
18 | 19 |
20 | 21 | 22 | 23 | 25 |
26 | 27 |
28 | 29 |
30 | 31 | 32 | 64 | {% endblock %} 65 | -------------------------------------------------------------------------------- /asset/urls.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | from django.conf.urls import patterns, include, url 3 | from asset.views import * 4 | 5 | urlpatterns = patterns('', 6 | url(r'^list/$', asset_list, name='asset_list'), 7 | url(r'^get/$', get, name='get'), 8 | url(r'^goServices/$', goServices, name='goServices'), 9 | url(r'^getData/$', getData, name='getData'), 10 | url(r'^getServices/$', getServices, name='getServices'), 11 | url(r'^goRevert/$', goRevert, name='goRevert'), 12 | url(r'^goRevertResult/$', goRevertResult, name='goRevertResult'), 13 | url(r'^revert/$', revert, name='revert'), 14 | url(r'^goconf/$', goConfHTML, name='goConf'), 15 | url(r'^goConfResult/$', goConfResult, name='goConfResult'), 16 | url(r'^test/$', test, name='test'), 17 | url(r'^getProjectList/$', getProjectList, name='getProjectList'), 18 | url(r'^getConfProject/$', getConfProject, name='getConfProject'), 19 | url(r'^getText/$', getText, name='getText'), 20 | url(r'^gobuild/$', go_build, name='gobuild'), 21 | url(r'^getBuildList/$', getBuildList, name='getBuildList'), 22 | url(r'^build_go/$', build_go, name='build_go'), 23 | url(r'^goStatus/$', go_status, name='go_status'), 24 | url(r'^crontabUpdate/$', crontab_update, name='crontab_update'), 25 | url(r'^cronjob_list/$', cronjob_list, name='cronjob_list'), 26 | url(r'^go_template/$', go_template_html, name='go_template'), 27 | url(r'^get_gotemplate_project/$', get_gotemplate_project, name='get_gotemplate_project'), 28 | url(r'^go_template_result/$', go_template_result, name='go_template_result'), 29 | url(r'^get_go_revert_list/$', get_go_revert_list, name='get_go_revert_list'), 30 | url(r'^qcloud/$', qcloud, name='qcloud'), 31 | url(r'^qingcloud/$', qingcloud, name='qingcloud'), 32 | url(r'^group/list/$', asset_list, name='group_list'), ### 资产组 ### 33 | url(r'^idc/list/$', asset_list, name='idc_list'), ### 机房 ### 34 | ) 35 | -------------------------------------------------------------------------------- /templates/winservices.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 | 5 | 6 |
7 |
8 |
9 | 10 | 11 | 12 | 17 |
18 | 19 |
20 | 21 | 22 | 23 | 25 |
26 | 27 |
28 | 29 |
30 | 31 | 32 | 64 | {% endblock %} 65 | -------------------------------------------------------------------------------- /project_crontab/cron.py: -------------------------------------------------------------------------------- 1 | # coding:utf8 2 | from crontab import CronTab 3 | import commands 4 | import sys 5 | import croniter 6 | import socket 7 | import traceback 8 | 9 | from project_crontab import models 10 | from asset import models as asset_models 11 | 12 | reload(sys) 13 | sys.setdefaultencoding('utf-8') 14 | 15 | 16 | def syncCronHost2DB(): 17 | """ 18 | 将服务器上的crontab同步至DB中 19 | """ 20 | res = True 21 | hostname = socket.gethostname() 22 | try: 23 | salt_obj = asset_models.minion.objects.get(saltname=hostname) 24 | except asset_models.minion.DoesNotExist: 25 | res = False 26 | else: 27 | my_cron = CronTab(tabfile='/etc/crontab', user=False) 28 | for job in my_cron: 29 | project_name = job.command.split(' ')[0].split('/')[-1] 30 | job_frequency = str(job).split(project_name)[0].strip('#').strip() 31 | if job_frequency == '@hourly': 32 | job_frequency = '0 * * * *' 33 | elif job_frequency == '@daily': 34 | job_frequency = '0 0 * * *' 35 | elif job_frequency == '@yearly': 36 | job_frequency = '0 0 1 1 *' 37 | 38 | try: 39 | models.CrontabCmd.objects.get(auto_cmd=job.command, frequency=job_frequency) 40 | except models.CrontabCmd.DoesNotExist: 41 | if job.is_enabled(): 42 | cmd_status = 2 43 | else: 44 | cmd_status = 1 45 | 46 | last_run_time = job.schedule().get_prev() 47 | 48 | try: 49 | svn_obj = asset_models.crontab_svn.objects.get(hostname=salt_obj, project=project_name) 50 | except asset_models.crontab_svn.DoesNotExist: 51 | print ' ' 52 | print job.command 53 | print 'Svn.DoesNotExist' 54 | else: 55 | try: 56 | models.CrontabCmd.objects.create(svn=svn_obj, cmd=job.command, auto_cmd=job.command, frequency=job_frequency, cmd_status=cmd_status, last_run_time=last_run_time) 57 | print 'create--ok' 58 | except Exception as e: 59 | print ' ' 60 | print job.command 61 | print 'create Exception---', traceback.print_exc() 62 | else: 63 | print 'ct cmd already exist in DB' 64 | return res 65 | -------------------------------------------------------------------------------- /static/js/highcharts/modules/solid-gauge.js: -------------------------------------------------------------------------------- 1 | /* 2 | Highcharts JS v4.0.1 (2014-04-24) 3 | Solid angular gauge module 4 | 5 | (c) 2010-2014 Torstein Honsi 6 | 7 | License: www.highcharts.com/license 8 | */ 9 | (function(a){var l=a.getOptions().plotOptions,o=a.pInt,p=a.pick,j=a.each,m;l.solidgauge=a.merge(l.gauge,{colorByPoint:!0});m={initDataClasses:function(b){var h=this,e=this.chart,c,k=0,f=this.options;this.dataClasses=c=[];j(b.dataClasses,function(g,d){var i,g=a.merge(g);c.push(g);if(!g.color)f.dataClassColor==="category"?(i=e.options.colors,g.color=i[k++],k===i.length&&(k=0)):g.color=h.tweenColors(a.Color(f.minColor),a.Color(f.maxColor),d/(b.dataClasses.length-1))})},initStops:function(b){this.stops= 10 | b.stops||[[0,this.options.minColor],[1,this.options.maxColor]];j(this.stops,function(b){b.color=a.Color(b[1])})},toColor:function(b,h){var e,c=this.stops,a,f=this.dataClasses,g,d;if(f)for(d=f.length;d--;){if(g=f[d],a=g.from,c=g.to,(a===void 0||b>=a)&&(c===void 0||b<=c)){e=g.color;if(h)h.dataClass=d;break}}else{this.isLog&&(b=this.val2lin(b));e=1-(this.max-b)/(this.max-this.min);for(d=c.length;d--;)if(e>c[d][0])break;a=c[d]||c[d+1];c=c[d+1]||a;e=1-(c[0]-e)/(c[0]-a[0]||1);e=this.tweenColors(a.color, 11 | c.color,e)}return e},tweenColors:function(b,a,e){var c=a.rgba[3]!==1||b.rgba[3]!==1;return b.rgba.length===0||a.rgba.length===0?"none":(c?"rgba(":"rgb(")+Math.round(a.rgba[0]+(b.rgba[0]-a.rgba[0])*(1-e))+","+Math.round(a.rgba[1]+(b.rgba[1]-a.rgba[1])*(1-e))+","+Math.round(a.rgba[2]+(b.rgba[2]-a.rgba[2])*(1-e))+(c?","+(a.rgba[3]+(b.rgba[3]-a.rgba[3])*(1-e)):"")+")"}};a.seriesTypes.solidgauge=a.extendClass(a.seriesTypes.gauge,{type:"solidgauge",bindAxes:function(){var b;a.seriesTypes.gauge.prototype.bindAxes.call(this); 12 | b=this.yAxis;a.extend(b,m);b.options.dataClasses&&b.initDataClasses(b.options);b.initStops(b.options)},drawPoints:function(){var b=this,h=b.yAxis,e=h.center,c=b.options,k=b.chart.renderer;a.each(b.points,function(f){var g=f.graphic,d=h.startAngleRad+h.translate(f.y,null,null,null,!0),i=o(p(c.radius,100))*e[2]/200,l=o(p(c.innerRadius,60))*e[2]/200,n=h.toColor(f.y,f),j;if(n!=="none")j=f.color,f.color=n;c.wrap===!1&&(d=Math.max(h.startAngleRad,Math.min(h.endAngleRad,d)));d=d*180/Math.PI;d={x:e[0],y:e[1], 13 | r:i,innerR:l,start:h.startAngleRad,end:d/(180/Math.PI)};g?(i=d.d,g.attr({fill:f.color}).animate(d,{step:function(b,c){g.attr("fill",m.tweenColors(a.Color(j),a.Color(n),c.pos))}}),d.d=i):f.graphic=k.arc(d).attr({stroke:c.borderColor||"none","stroke-width":c.borderWidth||0,fill:f.color}).add(b.group)})},animate:null})})(Highcharts); 14 | -------------------------------------------------------------------------------- /templates/goConf.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 | 5 | 6 |
7 |
8 | 9 | 10 |
11 | 12 | 13 | 14 | 19 |
20 | 21 | 22 |
23 | 24 | 25 | 26 | 29 |
30 | 31 |
32 | 33 |
34 | 35 | 36 |
37 | 38 | 39 | 72 | 73 | {% endblock %} 74 | -------------------------------------------------------------------------------- /templates/go_template.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% include 'link_css.html' %} 3 | {% block content %} 4 | 5 | 6 |
7 |
8 | 9 | 10 |
11 | 12 | 13 | 14 | 19 |
20 | 21 | 22 |
23 | 24 | 25 | 26 | 29 |
30 | 31 |
32 | 33 |
34 | 35 | 36 |
37 | 38 | 39 | 72 | 73 | {% endblock %} 74 | -------------------------------------------------------------------------------- /asset/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from asset.models import * 3 | # Register your models here. 4 | 5 | 6 | class goServicesAdmin(admin.ModelAdmin): 7 | list_display = ('ip','name','env','group','saltminion','owner','has_statsd','has_sentry','comment','ports','level') 8 | search_fields = ['name','owner'] 9 | 10 | class svnAdmin(admin.ModelAdmin): 11 | list_display = ('username','password','repo','localpath','movepath','revertpath','executefile','project') 12 | 13 | class goconfAdmin(admin.ModelAdmin): 14 | list_display = ('username','password','repo','localpath','env','project','hostname') 15 | 16 | class assetAdmin(admin.ModelAdmin): 17 | list_display = ('hostname','ip','system_type','asset_type','cpu','memory','wan_ip') 18 | search_fields = ['hostname','ip','asset_type','wan_ip'] 19 | 20 | class gobuildAdmin(admin.ModelAdmin): 21 | list_display = ('env','hostname') 22 | 23 | class gostatusAdmin(admin.ModelAdmin): 24 | list_display = ('hostname','supervisor_host','supervisor_username','supervisor_password','supervisor_port') 25 | 26 | class crontabSVNAdmin(admin.ModelAdmin): 27 | list_display = ('hostname','username','password','repo','localpath','project') 28 | 29 | class minionAdmin(admin.ModelAdmin): 30 | list_display = ('saltname','ip') 31 | search_fields = ['saltname'] 32 | 33 | class gotemplateAdmin(admin.ModelAdmin): 34 | list_display = ('username','password','repo','localpath','env','project','hostname') 35 | search_fields = ['repo'] 36 | 37 | class UserProfileAdmin(admin.ModelAdmin): 38 | list_display = ('user','phone_number') 39 | 40 | class GoServiceRevisionAdmin(admin.ModelAdmin): 41 | list_display = ('name','last_rev','last_clock', 'gotemplate_last_rev') 42 | search_fields = ['name'] 43 | 44 | class CronMinionAdmin(admin.ModelAdmin): 45 | list_display = ('name','saltminion') 46 | search_fields = ['name'] 47 | 48 | admin.site.register(IDC) 49 | admin.site.register(Asset,assetAdmin) 50 | admin.site.register(AssetRecord) 51 | admin.site.register(AssetGroup) 52 | admin.site.register(minion,minionAdmin) 53 | admin.site.register(goservices,goServicesAdmin) 54 | admin.site.register(gogroup) 55 | admin.site.register(svn,svnAdmin) 56 | admin.site.register(goconf,goconfAdmin) 57 | admin.site.register(gobuild,gobuildAdmin) 58 | admin.site.register(gostatus,gostatusAdmin) 59 | admin.site.register(crontab_svn,crontabSVNAdmin) 60 | admin.site.register(GOTemplate,gotemplateAdmin) 61 | admin.site.register(UserProfile,UserProfileAdmin) 62 | admin.site.register(GoServiceRevision,GoServiceRevisionAdmin) 63 | admin.site.register(cron_minion,CronMinionAdmin) 64 | -------------------------------------------------------------------------------- /static/js/wssh.js: -------------------------------------------------------------------------------- 1 | /* 2 | WSSH Javascript Client 3 | 4 | Usage: 5 | 6 | var client = new WSSHClient(); 7 | 8 | client.connect({ 9 | // Connection and authentication parameters 10 | username: 'root', 11 | hostname: 'localhost', 12 | authentication_method: 'password', // can either be password or private_key 13 | password: 'secretpassword', // do not provide when using private_key 14 | key_passphrase: 'secretpassphrase', // *may* be provided if the private_key is encrypted 15 | 16 | // Callbacks 17 | onError: function(error) { 18 | // Called upon an error 19 | console.error(error); 20 | }, 21 | onConnect: function() { 22 | // Called after a successful connection to the server 23 | console.debug('Connected!'); 24 | 25 | client.send('ls\n'); // You can send data back to the server by using WSSHClient.send() 26 | }, 27 | onClose: function() { 28 | // Called when the remote closes the connection 29 | console.debug('Connection Reset By Peer'); 30 | }, 31 | onData: function(data) { 32 | // Called when data is received from the server 33 | console.debug('Received: ' + data); 34 | } 35 | }); 36 | 37 | */ 38 | 39 | function WSSHClient() { 40 | } 41 | 42 | WSSHClient.prototype._generateEndpoint = function(options) { 43 | console.log(options); 44 | if (window.location.protocol == 'https:') { 45 | var protocol = 'wss://'; 46 | } else { 47 | var protocol = 'ws://'; 48 | } 49 | 50 | var endpoint = protocol + window.location.host + ':8080' + '/terminal'; 51 | return endpoint; 52 | }; 53 | 54 | WSSHClient.prototype.connect = function(options) { 55 | var endpoint = this._generateEndpoint(options); 56 | 57 | if (window.WebSocket) { 58 | this._connection = new WebSocket(endpoint); 59 | } 60 | else if (window.MozWebSocket) { 61 | this._connection = MozWebSocket(endpoint); 62 | } 63 | else { 64 | options.onError('WebSocket Not Supported'); 65 | return ; 66 | } 67 | 68 | this._connection.onopen = function() { 69 | options.onConnect(); 70 | }; 71 | 72 | this._connection.onmessage = function (evt) { 73 | var data = JSON.parse(evt.data.toString()); 74 | if (data.error !== undefined) { 75 | options.onError(data.error); 76 | } 77 | else { 78 | options.onData(data.data); 79 | } 80 | }; 81 | 82 | this._connection.onclose = function(evt) { 83 | options.onClose(); 84 | }; 85 | }; 86 | 87 | WSSHClient.prototype.send = function(data) { 88 | this._connection.send(JSON.stringify({'data': data})); 89 | }; 90 | -------------------------------------------------------------------------------- /static/js/custom/project.js: -------------------------------------------------------------------------------- 1 | /********************************* 2 | * Author: HuangYao 3 | * Content: 定义项目管理界面的动作 4 | *********************************/ 5 | 6 | $(document).ready(function () { 7 | $('#addProjectButton').click(function () { 8 | let svn_id = $("#svn_select").val(); 9 | let name = $("#project_name").val().trim(); 10 | let path = $("#project_path").val().trim(); 11 | if (svn_id.length === 0 || name.length === 0 || path.length === 0) { 12 | alert("请填写必填内容"); 13 | return false; 14 | } 15 | if (path.charAt(path.length - 1) != "/") { 16 | alert("本地路径必须以'/'结尾"); 17 | return false; 18 | } 19 | let url = "/crontab_manage/cronProject/add/"; 20 | let data = { 21 | 'svn_id': svn_id, 22 | 'name': name, 23 | 'path': path, 24 | }; 25 | $.ajax({ 26 | url: url, 27 | type: "POST", 28 | data: data, 29 | contentType: 'application/x-www-form-urlencoded', 30 | traditional: true, 31 | success: function (result) { 32 | if (result.code === 0) { 33 | window.location.reload(); 34 | } 35 | else { 36 | alert(result.msg) 37 | } 38 | }, 39 | error: function () { 40 | alert('失败'); 41 | } 42 | }); 43 | }); 44 | 45 | $('#deleteProjectButton').click(function () { 46 | let del_svn_ids = []; 47 | $("#editable").find(":checkbox:checked").each(function () { 48 | let salt_id = $(this).val(); 49 | if (!isNaN(salt_id)){ 50 | del_svn_ids.push(salt_id); 51 | } 52 | }); 53 | 54 | if (del_svn_ids.length === 0) { 55 | alert("请选择要删除的项目"); 56 | return false; 57 | } 58 | let url = "/crontab_manage/cronProject/del/"; 59 | let data = { 60 | 'svn_ids': del_svn_ids, 61 | }; 62 | $.ajax({ 63 | url: url, 64 | type: "POST", 65 | data: data, 66 | contentType: 'application/x-www-form-urlencoded', 67 | traditional: true, 68 | success: function (result) { 69 | if (result.code === 0) { 70 | window.location.reload(); 71 | } 72 | else { 73 | alert(result.msg) 74 | } 75 | }, 76 | error: function () { 77 | alert('失败'); 78 | } 79 | }); 80 | }); 81 | 82 | }); 83 | 84 | -------------------------------------------------------------------------------- /templates/gostatus.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block content %} 4 | 5 |
6 |
7 | {% for hostname in hosts %} 8 | 9 | {% endfor %} 10 |
11 |
12 | 13 | 14 | 15 |
16 |
17 |
18 |
19 |
20 |
Services详细信息列表
21 | 32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {% for info in status %} 46 | 47 | 48 | 49 | 50 | 51 | 52 | {% endfor %} 53 | 54 |
State Description Name Logfile
{{ info.statename }} {{ info.description }} {{ info.name }} {{ info.logfile }}
55 |
56 |
57 |
58 |
59 |
60 | {% endblock %} 61 | 62 | -------------------------------------------------------------------------------- /templates/cronjob_list.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block content %} 4 | 5 | 6 |
7 |
8 |
9 |
10 |
11 |
CRON JOB列表
12 | 23 |
24 | 25 |
26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | {% for dic in cron_list %} 37 | {% for job,time in dic.items %} 38 | 39 | 40 | 41 | 42 | {% endfor %} 43 | {% endfor %} 44 | 45 |
cron_joblast_run
{{ job }} {{ time }}
46 |
47 |
48 |
    49 | {% if cron_list.has_previous %} 50 |
  • Previous
  • 51 | {% endif %} 52 |
  • Page {{ cron_list.number }} of {{ cron_list.paginator.num_pages }}.
  • 53 | {% if cron_list.has_next %} 54 |
  • Next
  • 55 | {% endif %} 56 |
57 |
58 |
59 |
60 |
61 | 62 | 63 | 64 | {% endblock %} 65 | --------------------------------------------------------------------------------