第十二节 shell编写监控脚本
来源:互联网 发布:淘宝海外代购要身份证 编辑:程序博客网 时间:2024/05/18 18:04
一.nc的用法
nc(netcat),一般我们多用在局域网内传送文件(scp多用在跳板机存在的情况),可查询man nc查看它的说明,更多用法请google之。
1.基本参数
①想要连接到某处:
nc [-options] hostname port[s] [ports] ......
②绑定端口等待连接:
nc -l -p port [-options] [hostname] [port]
参数:
-g gateway source-routing hop point[s], up to 8
-G num source-routing pointer: 4, 8, 12, ……
-h 帮助信息
-i seconds延时的间隔
-l 监听模式,用于入站连接
-n 指定数字的IP地址,不能用hostname
-o file 记录16进制的传输
-p port本地端口号
-r 任意指定本地及远程端口
-s addr本地源地址
-u UDP模式
-v 详细输出——用两个
-v可得到更详细的内容
-w seconds timeout的时间
-z 将输入输出关掉——用于扫描时,其中端口号可以指定一个或者用lo-hi式的指定范围。
2.用法举例
1)端口扫描 (多做远程端口监控)
nc -v -w 3 10.1.50.58 -z 21-25
结果如下:
nc: connect to 10.1.50.58 port 21 (tcp) failed: Connection refused Connection to 10.1.50.58 22 port [tcp/ssh] succeeded! nc: connect to 10.1.50.58 port 23 (tcp) failed: Connection refused nc: connect to 10.1.50.58 port 24 (tcp) failed: Connection refused nc: connect to 10.1.50.58 port 25 (tcp) failed: Connection refused
2)文件拷贝
a.启动监听:
nc -l 9999 > tmp.txt
b.传送文件:
nc 0.0.0.0 9999 < .bashrc
c.查看文件:
cat tmp.txt
3)聊天工具–一般不怎么用
在10.1.50.58上: nc -l 1111
在mx9.mail.sohu.com上: nc 10.1.50.58 1111
这样,双方就可以相互交流了。使用ctrl+C(或D)退出。
3.用nc操作memcache及nosql等
1)存储数据:printf “set key 0 10 4\r\nkaka\r\n” |nc 10.1.50.58 11211
2)获取数据:printf “get key\r\n” |nc 10.1.50.58 11211
3)删除数据:printf “delete key\r\n” |nc 10.1.50.58 11211
4)查看状态:printf “stats\r\n” |nc 10.1.50.58 11211
二.编写web服务器监控脚本
三.编写mysql数据库监控脚本
四.编写disk空间使用监控脚本
五.编写mem空间使用监控脚本
- 第十二节 shell编写监控脚本
- shell学习十四--编写监控mysql脚本
- 编写shell脚本监控java虚拟机内存回收(gc)
- 编写可以监控oracle监听器是否启动的shell脚本
- 主机监控shell脚本
- Shell:监控脚本
- 主机监控Shell脚本
- shell脚本监控
- shell服务器监控脚本
- Shell监控脚本
- 监控磁盘空间shell脚本
- shell 监控脚本
- shell脚本监控进程
- shell脚本编写技巧
- 编写shell脚本
- 编写shell脚本
- 如何编写shell 脚本
- shell脚本的编写
- MVC中使用signalR入门教程
- 二叉搜索树的插入与删除操作
- Linux安装openssh详细步骤及遇到问题的解决方案
- 二维码(QR code)基本结构及生成原理
- 算法在计算机中的作用
- 第十二节 shell编写监控脚本
- 《Spring》-----容器的注解
- python装饰器的执行过程
- Learn Java 接口
- BootStrap组件
- 【51单片机学习过程记录】16 中断之 串口中断的应用2(中断方式)
- 微信小程序开发指南,含最新api
- Install TensorFlow(V0.11.0) on Mac OSX (Sierra)
- approximate CBR stream