{"id":19150933,"url":"https://github.com/hequan2017/cmdb","last_synced_at":"2025-04-15T06:54:44.590Z","repository":{"id":45123992,"uuid":"99914743","full_name":"hequan2017/cmdb","owner":"hequan2017","description":"资产管理、主机管理、批量执行命令|脚本、流量图、webssh    本项目已停止开发！因长时间未对代码进行维护，可能会造成项目在不同环境上无法部署、运行BUG等问题，请知晓！项目仅供参考！","archived":false,"fork":false,"pushed_at":"2022-01-06T22:24:17.000Z","size":3267,"stargazers_count":129,"open_issues_count":2,"forks_count":48,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-15T06:54:38.526Z","etag":null,"topics":["django","django-crontab","django-suit","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hequan2017.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-10T11:13:26.000Z","updated_at":"2024-08-20T16:44:40.000Z","dependencies_parsed_at":"2022-08-26T10:12:10.143Z","dependency_job_id":null,"html_url":"https://github.com/hequan2017/cmdb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fcmdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fcmdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fcmdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fcmdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hequan2017","download_url":"https://codeload.github.com/hequan2017/cmdb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249023710,"owners_count":21199958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-crontab","django-suit","python3"],"created_at":"2024-11-09T08:13:24.172Z","updated_at":"2025-04-15T06:54:44.570Z","avatar_url":"https://github.com/hequan2017.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CMDB\r\n\r\n\r\n## 本项目停止更新\r\n本项目已停止开发！因长时间未对代码进行维护，可能会造成项目在不同环境上无法部署、运行BUG等问题，请知晓！项目仅供参考！\r\n\r\n\r\n## 架构\r\n----------------\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/111.png)\r\n\r\n\r\n## DEMO\r\n---------------\r\n\r\n* github链接：`https://github.com/hequan2017/cmdb`\r\n\r\n* 博客： `http://hequan.blog.51cto.com/`\r\n\r\n* 群 号：`620176501`   \u003ca target=\"_blank\" href=\"//shang.qq.com/wpa/qunwpa?idkey=bbe5716e8bd2075cb27029bd5dd97e22fc4d83c0f61291f47ed3ed6a4195b024\"\u003e\u003cimg border=\"0\" src=\"https://github.com/hequan2017/cmdb/blob/master/static/img/group.png\"  alt=\"cmdb开发讨论群\" title=\"cmdb开发讨论群\"\u003e\u003c/a\u003e\r\n\r\n\r\n## 部署说明\r\n-------------------\r\n\r\n* 环境 python3.6.1  django1.11.4\r\n\r\n\r\n* 服务器请yum 安装  `sshpass` ，不然无法获取资产信息。\r\n\r\n\r\n```\r\ngit  clone  git@github.com:hequan2017/cmdb.git\r\n\r\ncd cmdb/\r\n\r\npip install -r requirements.txt     \r\n\r\npip install https://github.com/darklow/django-suit/tarball/v2\r\n```\r\n需要从这里下载  必须用这个版本，其他版本的suit不支持1.11版本django\r\n\r\n\r\n\r\n## 配置 celery 异步任务\r\n\r\n* 执行 `install_redis.sh` \r\n\r\n## 安装 `supervisor  `\r\n\r\n* `supervisor` 只支持 `python2`,不影响启动`python3`\r\n \r\n \r\n `pip2 install    supervisor`      \r\n\r\n\r\n* 生成配置文件，且放在`/etc`目录下\r\n\r\n\r\n`echo_supervisord_conf \u003e /etc/supervisord.conf  `\r\n \r\n\r\n* 为了不将所有新增配置信息全写在一个配置文件里，这里新建一个文件夹，每个程序设置一个配置文件，相互隔离\r\n\r\n`mkdir /etc/supervisord.d/  `\r\n \r\n\r\n* 修改配置文件\r\n\r\n\r\n`vim /etc/supervisord.conf`\r\n\r\n\r\n* 加入以下配置信息\r\n\r\n\r\n```\r\n[include]\r\nfiles = /etc/supervisord.d/*.conf\r\n```\r\n\r\n\r\n* 在supervisord.conf中设置通过web可以查看管理的进程，加入以下代码（默认即有，取消注释修改即可）\t\r\n\r\n\r\n```\r\n[inet_http_server] \r\nport=0.0.0.0:9001 \r\nusername=user\r\npassword=123\r\n```\r\n\r\n\r\n\r\n* 将 `supervisor.conf` 拷贝到 `/etc/supervisord.d/`下面\r\n\r\n\r\n* 执行`install_webssh.sh` 脚本， 安装`webconsole`模块。   需要修改的内容，可以看脚本。根据自己的情况修改。\r\n\r\n\r\n\r\n*  `/usr/bin/python2.7 /usr/bin/supervisord -c /etc/supervisord.conf`\r\n\r\n* 登陆 `0.0.0.0:9001` 账号 `user`  密码 `123`  就可以登陆进程管理界面\r\n\r\n*  `python manage.py  runserver  0.0.0.0:8001`    ##启动服务\r\n\r\n## 版本\r\n\r\n版本2.4\r\n-------------\r\n1. 进程管理 supervisor\r\n\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/10.png)\r\n\r\n\r\n版本2.3\r\n-------\r\n1. celery 异步任务。  可进后台  点击 首页 › Djcelery ›    进行管理\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/9.png)\r\n\r\n\r\n\r\n版本2.2\r\n-------\r\n1. web版本ssh，利用webconsole 。\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/8.png)\r\n\r\n\r\n\r\n版本2.1\r\n-------\r\n1. 利用SSH  获取CPU和内存使用率\r\n\r\n2. 利用django-crontab 做定时任务，每分钟获取一遍使用率，保存到monitor表里面，与host做关联。\r\n\r\n\r\n\r\n版本2.0\r\n-------\r\n1. 第一版版本功能基本定型。\r\n分为3块。 基础资源        主机（执行命令）     脚本（shell/python/yml）\r\n\r\n2. 接下来主要开发 利用zabbix api 调取数据 出图（暂未实现）\r\n\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/1.png)\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/2.png)\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/3.png)\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/4.png)\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/5.png)\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/7.png)\r\n\r\n后台\r\n\r\n![图片](https://github.com/hequan2017/cmdb/blob/master/static/img/6.png)\r\n\r\n\r\n\r\n\r\n\r\n\r\n## 历史\r\n------------------------\r\n\r\n版本更新1.7.5\r\n\r\n1. 批量执行shell/yml\r\n\r\n\r\n版本更新 1.7\r\n\r\n1. 版本小优化\r\n\r\n2. 更新后台admin模块 为suit v2版本\r\n\r\n\r\n\r\n版本更新 1.6\r\n\r\n1. 批量执行命令\r\n\r\n\r\n版本更新1.5.5\r\n\r\n1. 版本小优化\r\n\r\n\r\n版本更新1.5\r\n\r\n1. 增加资产更新，分别为 添加 查看 修改 更新 删除。 可真实获取到服务器资产\r\n\r\n\r\n版本更新1.4\r\n\r\n1. 增加命令行模式\r\n\r\n2. 增加历史命令记录\r\n\r\n\r\n版本更新1.3\r\n\r\n1. 新增主机管理板块，采用模态对话框。\r\n\r\n2. 增加更新服务器时间板块，采用ansible-playbook ，需要安装 ansible模块。 操作的命令可以看hostinfo/ansible_api/cmd.yml文件\r\n\r\n\r\n版本更新1.2\r\n\r\n1. 新增权限模块，采用admin自带的auth ，实现简单的权限管理。\r\n\r\n无添加权限的，看不见 添加板块 ，同时对权限进行判断， 无权限 打不可，显示 error界面。\r\n2. 根据权限 判断 是否为 管理员。\r\n\r\n\r\n版本更新1.1.2\r\n\r\n1 .修复了echarts 自适应更改大小。\r\n\r\n2. 更换了admin，采用django-suit 界面更好看，中文化。 需要安装 django-suit 模块。 admin的 帐号密码是 admin 1qaz.2wsx http://42.62.6.54:8001/admin\r\n\r\n\r\n版本更新1.1.1\r\n\r\n1. 新增 图形化展示数据， 采用百度 echart 动态展示 数据。\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhequan2017%2Fcmdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhequan2017%2Fcmdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhequan2017%2Fcmdb/lists"}