openspug / spug

开源运维平台:面向中小型企业设计的轻量级无Agent的自动化运维平台,整合了主机管理、主机批量执行、主机在线终端、文件在线上传下载、应用发布部署、在线任务计划、配置中心、监控、报警等一系列功能。
https://spug.cc
GNU Affero General Public License v3.0
10.32k stars 2.08k forks source link

请问下最新版本支持导出所有主机列表了吗? #574

Open feixia5712 opened 2 years ago

feixia5712 commented 2 years ago

请问下最新版本支持导出所有主机列表了吗?

zyupo commented 1 year ago

4.x 版本已经支持。 参考一下这里:https://github.com/openspug/spug/issues/535

feixia5712 commented 1 year ago

稳定版本目前还没推出来吧

yangshuDBA commented 8 months ago

可以使用mysql命令导出,调整下SQL就行。 --进入数据库 docker exec -it spug-db mysql -uroot -pspug.cc1 spug --设置字符集 set character_set_results=utf8; --查询组对应ID,取sort_id值 select from host_groups; --根据组sort_id,查询组内主机 select from hosts where id in (select host_id from host_groups_hosts where group_id=74 );

select * from hosts where id in (select host_id from host_groups_hosts where group_id=68 ); --导出数据 docker exec -it spug-db mysql -uroot -ppassword spug -e "SELECT hostname,port,name FROM hosts WHERE id IN (SELECT host_id FROM host_groups_hosts WHERE group_id IN (75, 76, 65));" > idc.txt

--备份数据 docker exec spug-db sh -c 'exec mysqldump spug -uroot -p"password"' > spug$(date +"%Y%m_%d")_spug_backup.sql