linux上c语言 获得网络接口的统计值
这个东东,蛮好玩的。其实就是读取了/proc/net/dev 文件。
struct netdev_stats {
unsigned long long rx_packets_m; /* total packets received */
unsigned long long tx_packets_m; /* total packets transmitted */
unsigned long long rx_bytes_m; /* total bytes received */
unsigned long long tx_bytes_m; /* total bytes transmitted */
unsigned long rx_errors_m; /* bad packets received */
unsigned long tx_errors_m; /* packet transmit problems */
unsigned long rx_dropped_m; /* no space in linux buffers */
unsigned long tx_dropped_m; /* no space available in linux */
unsigned long rx_multicast_m; /* multicast packets received */
unsigned long rx_compressed_m;
unsigned long tx_compressed_m;
unsigned long collisions_m;
/* detailed rx_errors: */
unsigned long rx_length_errors_m;
unsigned long rx_over_errors_m; /* receiver ring buff overflow */
unsigned long rx_crc_errors_m; /* recved pkt with crc error */
unsigned long rx_frame_errors_m; /* recv'd frame alignment error */
unsigned long rx_fifo_errors_m; /* recv'r fifo overrun */
unsigned long rx_missed_errors_m;&nb
相关文档:
#!/bin/bash
cpu=`top -b -n 1 | grep -w Cpu | awk '{print$5}'| awk -F '%' '{printf"%d",$1}'`
if [ $cpu -le 50 ]
then
echo "cpu: $((100 - cpu))%" > test.txt
mail -s "服务器紧急, CPU占用率过高!" yourmail@domail.com < test.txt
fi
mem=`top -b -n 1 | grep -w Me ......
由于在安装rhel5的时候没哟安装到好Samba,现在只能从新安装了。郁闷啊!(在init.d中没有发现smb和nmb这两个文件)
还好在安装盘里能够找到安装文件。这里就不说了(一堆samba开头的文件。一阵狂点就行了。呵呵……)
Samba 两个服务器相关启动程序、客户端及服务器配置文件
Samba 有两个服务器,一个是s ......
(七)DNS服务器配置实例
举例一:
使用view语句搭建具有内外视图功能的DNS服务器,并能够根椐不同的客户端地址实现不同的解析结果,假设局域网地址为192.168.255.0/24,局域网内各主机分别为rhel1:192.168.255.128; rhel2:192.168.255.12; rhel3:192.168.255.129; rhel4:192.168.255.120; rhel5:192.168.255.4为 ......
第一部分:Linux基础应用
1、《Linux从入门到精通》
http://www.gouhuo.com/study/linuxbook.zip
2、 Linux 系统安全与优化中文版
这本书的英文版“Get Acquainted with Linux Security and Optimization System”(简称LinuxSOS)是Linux文档计划(Linux Document Project)中比较新的一本指南。这本书不是L ......
Displaying the Routing Table:
netstat -nr
Displaying Interface Statistics:
netstat -i
Show the address resolution (ARP) tables:
netstat -p
Displaying Connections:
netstat -ta (linux)
netstat -a -f af:inet (opensolaris)
http://www.faqs.org/docs/linux_network/x-087-2-iface.netstat.html
http ......