Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | Github | OSChina 博客 | 云社区 | 云栖社区 | Facebook | Linkedin | 视频教程 | 打赏(Donations) | About
知乎专栏多维度架构 微信号 netkiller-ebook | QQ群:128659835 请注明“读者”

Netkiller Monitor 手札

Monitoring, Scanner, Sniffer and Audit...

Mr. Neo Chan, 陈景峯(BG7NYT)



中国广东省深圳市望海路半岛城邦三期
518067
+86 13113668890


2010-11-18

电子书最近一次更新于 2020-11-15 22:36:22 .

版权声明

转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。

http://www.netkiller.cn
http://netkiller.github.io
http://netkiller.sourceforge.net
微信订阅号 netkiller-ebook (微信扫描二维码)
QQ:13721218 请注明“读者”
QQ群:128659835 请注明“读者”
知乎专栏 | 多维度架构

2017-02-13

2020-11-15 22:36:22

内容摘要

本文档讲述Linux系统涵盖了系统管理与配置包括:

[注意]对初学Linux的爱好者忠告

玩Linux最忌reboot(重新启动)这是windows玩家坏习惯

Linux只要接上电源你就不要再想用reboot,shutdown,halt,poweroff命令,Linux系统和应用软件一般备有reload,reconfigure,restart/start/stop...不需要安装软件或配置服务器后使用reboot重新引导计算机

在Linux系统里SIGHUP信号被定义为刷新配置文件,有些程序没有提供reload参数,你可以给进程发送HUP信号,让它刷新配置文件,而不用restart.通过pkill,killall,kill 都可以发送HUP信号例如: pkill -HUP httpd

我的系列文档:

操作系统

Netkiller Linux 手札 Netkiller FreeBSD 手札 Netkiller Shell 手札
Netkiller Security 手札 Netkiller Web 手札 Netkiller Monitoring 手札
Netkiller Storage 手札 Netkiller Mail 手札 Netkiller Virtualization 手札
Netkiller Cryptography 手札   

以下文档停止更新合并到 《Netkiller Linux 手札》

Netkiller Debian 手札 Netkiller CentOS 手札 Netkiller Multimedia 手札    

致读者

Netkiller 系列电子书始于 2000 年,风风雨雨走过20年,将在 2020 年终结,之后不在更新。作出这种决定原因很多,例如现在的阅读习惯已经转向短视频,我个人的时间,身体健康情况等等......

感谢读者粉丝这20年的支持

虽然电子书不再更新,后面我还会活跃在知乎社区和微信公众号

目录

1. 自述
1.1. 写给读者
1.2. 作者简介
1.3. 如何获得文档
1.4. 打赏(Donations)
1.5. 联系方式
1. Prometheus
1.1. 安装 Prometheus
1.1.1. Docker 安装
1.1.2. docker swarm
1.1.3. docker-compose
1.2. Prometheus 命令行工具
1.2.1. 刷新配置文件
1.2.2. promtool 配置文件校验工具
1.3. prometheus 配置
1.3.1. rules 规则配置
1.3.1.1. recording rules
1.3.1.2. alerting rules
1.4. PromQL 自定义查询语言
1.4.1. Metrics 格式
1.4.2. metric 类型
1.4.2.1. Counter:只增不减的计数器
1.4.2.2. Gauge:可增可减的仪表盘
1.4.2.3. Histogram
1.4.2.4. Summary
1.4.3. 查询时间序列
1.4.3.1. 标签查询
1.4.3.2. 范围查询
1.4.3.3. 数学运算
1.4.4. 聚合操作
1.4.4.1. rate()
1.4.4.2. topk() 和 bottomk()
1.4.4.3. delta()
1.4.4.4. predict_linear()
1.4.4.5. deriv()
1.4.4.6. sum()
1.4.4.7. avg()
1.4.4.8. min (最小值),max (最大值)
1.4.4.9. count_values()
1.4.4.10. quantile()
1.5. Installing and Configuring Graphite
1.5.1.
1.5.2. 监控 Docker
1.5.3. cadvisor
1.6. Alertmanager
1.6.1. alertmanager.yml 配置文件
1.6.1.1. amtool 配置文件检查工具
1.6.1.2. global 全局配置项
1.6.1.3. route 路由配置
1.6.1.4. receivers 定义警报接收者
2. Zabbix
2.1. Installing and Configuring Zabbix
2.1.1. Ubuntu
2.1.2. CentOS Zabbix 2.4
2.1.3. Zabbix 3.x CentOS 7
2.2. web ui
2.2.1. 警告脚本
2.3. zabbix-java-gateway - Zabbix java gateway
2.4. zabbix-agent
2.4.1. Ubuntu
2.4.2. CentOS 7
2.4.3. zabbix_agentd 命令
2.4.4. Nginx status 监控
2.4.5. redis
2.4.6. MongoDB
2.4.6.1. 创建 Mongo 监控用户
2.4.6.2. Zabbix agentd 配置
2.4.6.3. Zabbix server 测试
2.4.7. PHP-FPM
2.4.7.1. 启用 php-fpm status 功能
2.4.7.2. 配置 nginx
2.4.7.3. 配置 Zabbix 代理
2.4.7.4. php-fpm 监控参数
2.4.8. Elasticsearch
2.4.8.1. 安装采集脚本
2.4.8.2. 配置Zabbix代理
2.4.9. Postfix
2.4.9.1. 安装采集脚本
2.4.9.2. userparameter_postfix.conf
2.4.10. TCP stats
2.4.10.1. 采集脚本
2.4.11. 应用依赖检查
2.4.12. Oracle
2.4.12.1. 采集脚本
2.4.12.2.
3. ElasticSearch + Logstash + Kibana
3.1. 安装
3.1.1. 6.x
3.1.2. ElasticSearch + Logstash + Kibana 安装
3.1.2.1. ElasticSearch 安装
3.1.2.2. Kibana 安装
3.1.2.3. Logstash 安装
3.1.2.4. 从 5.x 升级到 6.x
3.2. logstash 命令简单应用
3.2.1. -e 命令行运行
3.2.2. -f 指定配置文件
3.2.3. -t:测试配置文件是否正确,然后退出。
3.2.4. -l:日志输出的地址
3.2.5. log.level 启动Debug模式
3.3. 配置 Broker(Redis)
3.3.1. indexer
3.3.2. shipper
3.4. logstash 配置项
3.4.1. input
3.4.1.1. 标准输入输出
3.4.1.2. rubydebug
3.4.1.3. 本地文件
3.4.1.3.1. 指定文件类型
3.4.1.4. TCP/UDP
3.4.1.5. Redis
3.4.1.6. Kafka
3.4.1.7. jdbc
3.4.2. filter
3.4.2.1. 日期格式化
3.4.2.2. patterns
3.4.2.3. syslog
3.4.2.4. csv
3.4.2.5. 使用ruby 处理 CSV文件
3.4.2.6. 执行 ruby 代码
3.4.2.7. grok debug 工具
3.4.3. output
3.4.3.1. stdout
3.4.3.2. file 写入文件
3.4.3.3. elasticsearch
3.4.3.3.1. 自定义 index
3.4.3.4. exec 执行脚本
3.5. Example
3.5.1. Spring boot logback
3.5.2. 索引切割实例
3.5.3.
3.5.3.1.
3.6. Beats
3.6.1. 安装 Beta
3.6.1.1. Beats 6.x 安装
3.6.1.2. Beats 5.x 安装
3.6.2. Filebeat
3.7. FAQ
3.7.1. 查看 Kibana 数据库
3.7.2. logstash 无法写入 elasticsearch
3.7.3. 标准输出
3.7.4. 5.x 升级至 6.x 的变化
4. 监控命令
4.1. User
4.1.1. last, lastb - show listing of last logged in users
4.2. Memory
4.2.1. Memory
4.2.2. vmstat - Report virtual memory statistics
4.2.3. mpstat
4.2.4. pmap - report memory map of a process
4.3. CPU
4.3.1. uptime - Tell how long the system has been running.
4.3.2. top - display Linux tasks
4.3.3. atop - AT Computing's System & Process Monitor
4.3.4. htop - interactive process viewer
4.4. Processes
4.4.1. strace - trace system calls and signals
4.5. lsof - list open files 文件监控
4.5.1. $$
4.5.2. 监控文件系统
4.5.3. 设备文件
4.5.4. 用户监控
4.5.5. 监控进程
4.5.6. 监控网络
4.5.7. lsof 高级用法
4.5.8. 根据文件描述列出对应的文件信息
4.6. Harddisk IO
4.6.1. input/output statistics
4.6.1.1. 5 秒监控一次
4.6.2. iotop - simple top-like I/O monitor
4.6.3. ionice - set or get process I/O scheduling class and priority
4.6.4. smartd - SMART Disk Monitoring Daemon
4.7. Network IO
4.7.1. netstat
4.7.2. ss
4.7.2.1. 查看tcp流量控制相关参数值
4.7.3. iftop - display bandwidth usage on an interface by host
4.7.4. iptraf - Interactive Colorful IP LAN Monitor
4.7.5. nload: Console application which monitors network traffic and bandwidth
4.7.6. bwm - Bandwidth Monitor
4.7.7. iptstate - A top-like display of IP Tables state table entries
4.8. Service
4.8.1. NFS
4.8.1.1. nfsstat
4.8.1.2. nfswatch
4.8.2. apachetop
4.9. 文件监控
4.10. watchdog
4.11. nmon
4.12. Hardware
4.12.1. temperature/voltage/fan
4.12.2. mcelog - Decode kernel machine check log on x86 machines
4.13. sar - System Activity Reporter
4.14. SMS
4.14.1. gnokii
4.14.1.1. 安装
4.14.1.1.1. Ubuntu
4.14.1.1.2. CentOS
4.14.1.2. 配置
4.14.1.3. 发送测试短信
4.14.1.4. 接收短信
4.14.1.5. 拨打电话
4.14.2. AT Commands
4.14.2.1. 发送短信
4.14.2.2. 语音通话
4.15. IPMI (Intelligent Platform Management Interface)
4.15.1. OpenIPMI
4.15.2. freeipmi
4.15.2.1. ipmiping
4.15.2.2. ipmimonitoring
4.15.2.3. ipmi-sensors
4.15.2.4. ipmi-locate
4.15.3. ipmitool - utility for controlling IPMI-enabled devices
4.15.3.1. ipmitool
4.15.3.1.1. ubuntu
4.15.3.1.2. CentOS
4.15.3.2. sensor
4.15.3.3. ipmitool shell
4.15.3.4. ipmitool 访问远程主机
4.15.3.5. Get chassis status and set power state
4.15.3.6. Configure Management Controller
4.15.3.6.1. Management Controller status and global enables
4.15.3.6.2. Configure LAN Channels
4.15.3.6.3. Configure Management Controller users
4.15.3.6.4. Configure Management Controller channels
4.15.3.7. Example for iDRAC
4.15.3.7.1. 更改IP地址,子网掩码与网关
4.15.3.7.2. 更改 iDRAC LCD 显示屏
4.15.3.7.3. 更改 iDRAC 密码
4.15.3.7.4. 关机/开机
4.15.3.7.5. 启动列表
4.16. JVM
4.16.1. jconsole
4.16.2. jps - Java Virtual Machine Process Status Tool
4.16.3. jinfo - Configuration Info
4.16.4. jstat - Java Virtual Machine Statistics Monitoring Tool
4.16.5. jHiccup
5. Logs 分析
5.1. log
5.1.1. logwatch
5.1.2. logcheck : Analyzes log files and sends noticeable events as email
5.1.3. nulog
5.2. Web
5.2.1. Apache Log
5.2.1.1. 刪除日志
5.2.1.2. 统计爬虫
5.2.1.3. 统计浏览器
5.2.1.4. IP 统计
5.2.1.5. 统计域名
5.2.1.6. HTTP Status
5.2.1.7. URL 统计
5.2.1.8. 文件流量统计
5.2.1.9. URL访问量统计
5.2.1.10. 脚本运行速度
5.2.1.11. IP, URL 抽取
5.2.2. awstats
5.2.2.1. 语言
5.2.2.2. 输出HTML文档
5.2.2.3. 多站点配置
5.2.2.4. 合并日志
5.2.2.5. Flush history file on disk (unique url reach flush limit of 5000) 优化
5.2.2.6. JAWStats
5.2.3. webalizer
5.2.3.1. 手工生成
5.2.3.2. 批量处理历史数据
5.2.3.3. crontab
5.2.4. Sarg - Squid Analysis Report Generator
5.2.5. goaccess - Fast web log analyzer and interactive viewer.
5.3. Tomcat
5.3.1. 截取 0-3 点区间的日志
5.3.2. 监控Redis
5.4. Mail
5.4.1. pflogsumm.pl - Produce Postfix MTA logfile summary
5.5. OpenSSH 日志 /var/log/secure
5.5.1. 查看登陆用户
5.6. rinetd.log
5.7. php-syslog-ng
5.8. Log Analyzer
5.9. Splunk
5.10. Octopussy
5.11. eventlog-to-syslog
5.12. Apache Flume
5.12.1. 安装 Apache flume
5.12.2. 基本配置
5.12.3. 配置 MySQL 存储日志
5.12.4. 配置 HDFS 存储日志
5.13. graylog - Enterprise Log Management for All
6. 上一代监控系统
6.1. Varnish Dashboard
6.2. Cacti
6.2.1. Install Cacti for Ubuntu
6.2.2. Yum 安装
6.2.3. Source Install
6.2.4. Web 安装
6.2.5. Cacti plugins
6.2.5.1. Percona monitoring plugins
6.2.6. Template
6.2.6.1. Nginx
6.2.6.2. php-fpm
6.2.6.3. MySQL
6.2.6.4. Redis
6.2.6.5. Percona JMX Monitoring Template for Cacti
6.3. Nagios
6.3.1. Install
6.3.1.1. Nagios core
6.3.1.2. Monitor Client nrpe
6.3.1.3. Monitoring Windows Machines
6.3.1.4. PNP4Nagios 图表插件
6.3.2. nagios
6.3.3. nrpe node
6.3.4. 配置 Nagios
6.3.4.1. authorized
6.3.4.2. contacts
6.3.4.3. hostgroups
6.3.4.4. generic-service
6.3.4.5. SOUND OPTIONS
6.3.4.6. SMS 短信
6.3.4.7. nrpe plugins
6.3.5. 配置监控设备
6.3.5.1. routers
6.3.5.2. host
6.3.5.3. service
6.3.5.3.1. http
6.3.5.3.2. mysql hosts
6.3.5.3.3. check_tcp
6.3.6. Nagios Plugins
6.3.6.1. check_ping
6.3.6.2. check_procs
6.3.6.3. check_users
6.3.6.4. check_http
6.3.6.5. check_mysql
6.3.6.5.1. check_mysql
6.3.6.5.2. mysql.cfg check_mysql_replication
6.3.6.5.3. nrpe.cfg check_mysql_replication
6.3.6.6. Disk
6.3.6.6.1. disk.cfg
6.3.6.6.2. check_disk
6.3.6.6.3. disk-smb.cfg
6.3.6.7. check_tcp
6.3.6.7.1. 端口检查
6.3.6.7.2. Memcache
6.3.6.7.3. Redis
6.3.6.8. check_log
6.3.6.9. check_traffic
6.3.6.10. Nagios nrpe plugins
6.3.6.11. check_nt
6.3.6.12. nsca - Nagios Service Check Acceptor
6.3.6.13. jmx
6.3.7. FAQ
6.3.7.1. Macro Name
6.3.7.2. 插件开发手册
6.4. Munin
6.4.1. Ubuntu
6.4.1.1. Installation Monitor Server
6.4.1.2. Installation Node
6.4.1.3. Additional Plugins
6.4.1.4. plugins
6.4.1.4.1. mysql
6.4.1.4.2. apache
6.4.2. CentOS
6.4.3. 用户认证
6.4.4. munin-node and plugins
6.4.4.1. munin-node.conf
6.4.4.2. mysql plugin
6.4.4.3. apache plugin
6.4.4.4. memcached plugin
6.4.5. munin.conf
6.4.6. munin-node
6.4.6.1. munin-node.conf
6.5. Observium
6.5.1. Installation
6.6. Ganglia
6.6.1. Server
6.6.2. Client
6.6.3. Plugin
6.6.4. Installing Ganglia on Centos
6.7. icinga
6.8. Graphite
6.8.1. Graphite - Scalable Realtime Graphing
6.9. Apache SkyWalking
6.10. BIG BROTHER
6.11. Big Sister
6.12. OpenNMS
6.13. Performance Co-Pilot
6.14. Clumon Performance Monitor
6.15. Zenoss
6.16. 商业软件
6.17. Hyperic HQ
6.18. OSSIM,Spiceworks,FireGen,LANSweeper,OSSEC,HIDS
6.19. HawtIO
6.20. moloch
7. 网络监控
7.1. NET SNMP (Simple Network Management Protocol)
7.1.1. 安装SNMP
7.1.1.1. Ubuntu
7.1.1.1.1. snmpd.conf
7.1.1.1.2. SNMP v3
7.1.1.2. CentOS
7.1.1.2.1. Configure SNMPv3 on CentOS or RHEL
7.1.2. 配置SNMP
7.1.2.1. community 配置
7.1.2.2. 定义可操作的范围
7.1.3. SNMP 命令
7.1.3.1. snmpwalk
7.1.3.2. snmpget
7.1.3.3. snmptest
7.1.4. Cisco MBI
7.1.4.1. Cisco 3750
7.1.4.2. Cisco ASA 5550
7.2. Bandwidth
7.2.1. apt-get install
7.2.2. CentOS rpm/yum
7.2.3. source code
7.2.4. /etc/bandwidthd.conf
7.3. NetFlow
7.3.1. flow-tools - collects and processes NetFlow data
7.3.1.1. flow-capture
7.3.1.2. NetFlow into MySQL with flow-tools
7.3.2. netams - Network Traffic Accounting and Monitoring Software
7.3.2.1. netams-web
7.4. Ntop
7.4.1. Installation
7.4.1.1. Ubuntu
7.4.1.2. CentOS
7.4.2. Web UI
7.4.3. Plugins
7.4.3.1. NetFlow
7.5. MRTG
7.5.1. Ubuntu 安装
7.5.2. CentOS 安装
7.5.3. 监控多个设备
7.5.4. 批量生成监控配置文件
7.5.5. 图片尺寸
7.6. lvs-rrd
8. OpenTSDB
9. Zipkin 分布式链路追踪

范例清单

2.1. zabbix-agent 配置实例
3.1. spring boot logback
3.2. Elasticsearch 索引切割示例
4.1. nmon
5.1. config.php
6.1. cacti config.php
6.2.
7.1. mrtg