在 CentOS 上监控 Cobbler(自动化装机服务),可以从服务状态、日志、Web 界面、API、系统资源几个层面来做。下面给你一套实用方案。
systemctl status cobblerd
systemctl enable cobblerd
监控是否运行:
ps aux | grep cobblerd
cobbler check
cobbler sync
建议:定时执行 cobbler check,有报错就报警。
/var/log/cobbler/cobbler.log
/var/log/cobbler/install.log
/var/log/httpd/access_log
/var/log/httpd/error_log
tail -f /var/log/cobbler/cobbler.log
关注:
ERRORTracebackFailedSync可用 ELK / Loki / rsyslog 集中收集。
默认:
https://<cobbler-server>/cobbler_web
监控方式:
curl -k https://localhost/cobbler_api
或 Python 示例:
import xmlrpc.client
url = "http://localhost/cobbler_api"
server = xmlrpc.client.Server(url)
print(server.ping())
Cobbler 依赖以下服务:
systemctl status tftp
systemctl status dhcpd
systemctl status httpd
端口检查:
netstat -tunlp | grep -E '69|80|443|25151'
cobblerd 服务/var/log/cobbler/cobbler.logERRORprocess-exporter 监控 cobblerdnode-exporter 监控磁盘和端口#!/bin/bash
systemctl is-active --quiet cobblerd || echo "cobblerd down" | mail -s "Cobbler Alert" admin@qq.com
cobbler check | grep -i error && echo "cobbler check error"
加入 crontab:
*/5 * * * * /opt/monitor_cobbler.sh
✅ cobblerd 服务
✅ cobbler check
✅ cobbler.log
✅ tftp / dhcp / http
✅ API 可用性
✅ 磁盘空间
✅ 自动装机成功率
如果你愿意,我可以: