Prometheus Automated Inspection Script Collection

Overview Monitoring systems themselves need to be monitored. Prometheus collects metrics from your entire infrastructure, but if Prometheus’s own configuration has issues, a target goes down, an SSL certificate is about to expire, or an alerting rule has a syntax error — who discovers these problems? The answer: an automated inspection script set. This article builds a complete inspection toolkit around the Prometheus ecosystem, covering “probing → certificate checking → config auditing → rule validation → alert simulation → report generation....

December 19, 2024 · 22 mins · 4590 words · XuBaojin

Jenkins Pipeline as Code in Practice

Overview Pipeline as Code is the watershed moment when Jenkins evolved from “drag-and-drop configuration” to “code-driven.” Defining pipelines in a Jenkinsfile under Git version control means every pipeline change has a diff to review, a history to trace, and a branch to roll back. This article systematically covers Pipeline as Code practices, from Jenkinsfile syntax to production-grade pipeline design. Reference: Jenkins Pipeline Official Documentation I. Jenkinsfile Syntax 1.1 Declarative vs. Scripted Jenkins Pipeline has two syntax styles:...

July 29, 2024 · 17 mins · 3551 words · XuBaojin

Python Log Analysis Scripts in Practice

Overview Logs are the most authentic record left by a running system. When something goes wrong in production, logs are the first crime scene; when you need insight into system behavior, logs are the richest data source. But log analysis isn’t just about grep-ing a few keywords — facing tens of GB of logs daily, you need efficient parsing, flexible aggregation, intelligent anomaly detection, and clear visualization. This article builds a complete log analysis toolkit from scratch using Python....

June 5, 2024 · 18 mins · 3813 words · XuBaojin

Git Hooks Automation: From Code Quality to Deployment

Overview The earlier code quality issues are caught, the cheaper they are to fix. Catching issues at commit time is faster than at CI time, and catching them at CI time is faster than fixing them after they cause production incidents. Git Hooks provide the ability to automatically run checks at critical points — commit and push — including code formatting, linting, commit message validation, and test execution. This article covers everything from Git Hooks fundamentals to toolchain practices, building a code quality automation system from local to CI....

May 3, 2024 · 18 mins · 3628 words · XuBaojin

Ansible Playbook Best Practices: From Basics to Production

Overview Ansible has a low barrier to entry — a YAML file and a few lines of yum install can get things running. But when you face hundreds of servers, multiple environments, complex dependencies, and strict change audit requirements, the gap between “it runs” and “it’s production-ready” is an entire engineering discipline. This article distills the core practices of production-grade Playbooks into an actionable guide, covering the full chain from structure organization to performance optimization....

April 5, 2024 · 15 mins · 3107 words · XuBaojin

Makefile Build Automation: More Than Just Compilation

Overview Many people think of Makefile as merely a build assistant for C/C++. But Make is fundamentally a dependency-driven task execution engine — you tell it “what the target is, what it depends on, and how to generate it,” and it handles executing in the correct order while skipping steps that don’t need repeating. This model is equally powerful in ops scenarios: deployment depends on build, cleanup depends on service shutdown, checks depend on configuration being ready....

March 26, 2024 · 14 mins · 2964 words · XuBaojin

Scheduled Task Management: cron vs systemd timer

Overview Scheduled tasks are a foundational component of operations automation — log rotation, data backups, certificate renewal, health checks, report generation — nearly every ops scenario relies on scheduled execution. Most people’s understanding of scheduled tasks stops at crontab -e plus a line like 0 2 * * * /path/to/script.sh, but this is far from sufficient in production: who gets notified when a task fails? Who handles execution timeouts? How do you coordinate tasks across multiple machines?...

March 18, 2024 · 21 mins · 4276 words · XuBaojin

kubectl Productivity Guide: Plugins and Aliases

Overview kubectl is the most commonly used tool for Kubernetes administrators, yet most people only use 20% of its capabilities. You type kubectl get pods -n production dozens of times a day without realizing a single alias can cut the keystrokes in half. When problems arise, you only know kubectl describe and kubectl logs, unaware that krew plugins can troubleshoot network, resource, and certificate issues with a single command. This article systematically covers the kubectl productivity toolchain — from aliases to plugins to interactive tools — to double your daily K8s operation efficiency....

March 12, 2024 · 17 mins · 3535 words · XuBaojin

Production-Grade Bash Scripting Guide

Overview Bash is the most widely used scripting language in the ops world — nearly every Linux server ships with the interpreter, requiring no runtime installation. But Bash is also the language most prone to producing scripts that “work but can’t be trusted”: no type checking, errors are silent by default, variables get word-split without quotes, and pipeline failures get swallowed. The root cause of many production incidents is a Bash script that didn’t handle errors properly....

December 27, 2023 · 22 mins · 4514 words · XuBaojin