自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

用MRTG監(jiān)測Linux系統(tǒng)-硬盤監(jiān)控

運(yùn)維 系統(tǒng)運(yùn)維
用MRTG監(jiān)測Linux系統(tǒng)網(wǎng)絡(luò)、CPU、內(nèi)存和硬盤情況?MRTG(Multi Router Traffic Grapher)是一個(gè)監(jiān)控網(wǎng)絡(luò)鏈路流量負(fù)載的工具軟件,通過snmp協(xié)議得到設(shè)備的流量信息。本文講述的是:硬盤監(jiān)控

  用MRTG監(jiān)測Linux系統(tǒng)網(wǎng)絡(luò)、CPU、內(nèi)存和硬盤情況

  本文講述的是:用MRTG監(jiān)測Linux系統(tǒng)網(wǎng)絡(luò)、CPU、內(nèi)存和硬盤情況:

  原理介紹MRTG安裝監(jiān)控、CPU監(jiān)控、內(nèi)存監(jiān)控、硬盤監(jiān)控

  3)、獲得硬盤空間總量和使用量

  用命令df -kl查看硬盤空間情況

  1.   [root@intel bin]# df -kl  
  2.  
  3.   Filesystem 1k-blocks Used Available Use% Mounted on  
  4.  
  5.   /dev/sda5 2063504 1169204 789480 60% /  
  6.  
  7.   /dev/sda1 101089 8127 87743 9% /boot  
  8.  
  9.   /dev/sda2 8262068 2324004 5518368 30% /data  
  10.  
  11.   /dev/sda7 2063504 1364412 594272 70% /home  
  12.  
  13.   /dev/sda6 2063504 1288716 669968 66% /usr  
  14.  
  15.   /dev/sda3 2063536 350040 1608672 18% /var  
  16.  
  17.   /dev/sdb1 17654736 2964312 13793600 18% /data1  
  18.  

  總量=2063504+ 101089+8262068+2063504+2063504+2063536 +17654736 =34271941

  使用量=1169204+8127+2324004+1364412+1288716+350040+2964312=9469231

  1.   [root@intel bin]# vi df.pl  
  2.  
  3.   #!/usr/bin/perl  
  4.  
  5.   # This script was written on RedHat 9.0, it assumes that the command  
  6.  
  7.   # output(df -kl) looks like this:  
  8.  
  9.   # Filesystem 1k-blocks Used Available Use% Mounted on  
  10.  
  11.   # /dev/sda5 2063504 1169204 789480 60% /  
  12.  
  13.   # /dev/sda1 101089 8127 87743 9% /boot  
  14.  
  15.   # /dev/sda2 8262068 2324004 5518368 30% /data  
  16.  
  17.   # /dev/sda7 2063504 1364412 594272 70% /home  
  18.  
  19.   # /dev/sda6 2063504 1288716 669968 66% /usr  
  20.  
  21.   # /dev/sda3 2063536 350040 1608672 18% /var  
  22.  
  23.   # /dev/sdb1 17654736 2964312 13793600 18% /data1  
  24.  
  25.   #  
  26.  
  27.   # In which case, this script returns :  
  28.  
  29.   #  
  30.  
  31.   # 34271941  
  32.  
  33.   # 9469231  
  34.  
  35.   # when run.  
  36.  
  37.   foreach $filesystem (`df -kl | grep -v "Filesystem"`)  
  38.  
  39.   {  
  40.  
  41.   @df = split(/\s+/,$filesystem);  
  42.  
  43.   $total += $df[1];  
  44.  
  45.   $usage += $df[2];  
  46.  
  47.   }  
  48.  
  49.   print "$total\n";  
  50.  
  51.   print "$usage\n";  
  52.  
  53.   system ("uptime");  
  54.  
  55.   system ("uname -n");  
  56.  

  編輯配置文件(df.cfg)

  1.   [root@intel etc]#vi df.cfg  
  2.  
  3.   WorkDir:/usr/local/apache_1.3.31/htdocs/mrtg/df/  
  4.  
  5.   Target[localhost]: `/usr/local/mrtg/bin/df.pl`  
  6.  
  7.   Xsize[localhost]:300  
  8.  
  9.   Ysize[localhost]:100  
  10.  
  11.   Ytics[localhost]:10  
  12.  
  13.   Title[localhost]: Vfocus.Net SERVER Disk Space (34,271,941 kB / 36GB) Megabytes used  
  14.  
  15.   Unscaled[localhost]: dwym  
  16.  
  17.   MaxBytes[localhost]: 34271941  
  18.  
  19.   PageTop[localhost]: Vfocus.Net SERVER Disk Space(34,271,941 kB / 36GB) Megabytes used  
  20.  
  21.   kmg[localhost]: KB,MB,GB  
  22.  
  23.   LegendI[localhost]: Total Disk Space  
  24.  
  25.   LegendO[localhost]: Used Disk Space  
  26.  
  27.   Legend1[localhost]: Total Disk Space  
  28.  
  29.   Legend2[localhost]: Used Disk Space  
  30.  
  31.   YLegend[localhost]: Megabytes  
  32.  
  33.   ShortLegend[localhost]: &  
  34.  
  35.   Options[localhost]: growright,gauge,nopercent  
  36.  
  37.   [root@intel etc]# /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/df.cfg  
  38.  

  執(zhí)行三次,就沒有報(bào)警了。

  用indexmaker作index文件

  1.   [root@intel bin]# ./indexmaker --title="硬盤監(jiān)控" --output=/usr/local/apache_1.3.31/htdocs/mrtg/df/index.html /usr/local/mrtg/etc/df.cfg  
  2.  
  3.   [root@intel bin]# ./indexmaker --title="CPU監(jiān)控" --output=/usr/local/apache_1.3.31/htdocs/mrtg/cpu/index.html /usr/local/mrtg/etc/cpu.cfg  
  4.  
  5.   [root@intel bin]# ./indexmaker --title="內(nèi)存監(jiān)控" --output=/usr/local/apache_1.3.31/htdocs/mrtg/mem/index.html /usr/local/mrtg/etc/mem.cfg  
  6.  

  我們把mrtg 加入到crontab 中,讓他定時(shí)執(zhí)行:

  1.   */3 * * * * /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/mem.cfg  
  2.  
  3.   */3 * * * * /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/cpu.cfg  
  4.  
  5.   */3 * * * * /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/net1.cfg  
  6.  
  7.   */3 * * * * /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/df.cfg  
  8.  

  用MRTG監(jiān)測Linux系統(tǒng)網(wǎng)絡(luò)、CPU、內(nèi)存和硬盤情況就介紹到這里了。

【編輯推薦】

用MRTG在IIS上完成入侵檢測功能

MRTG監(jiān)控端的配置

MRTG的網(wǎng)絡(luò)流量監(jiān)測研究與應(yīng)用(應(yīng)用篇)

責(zé)任編輯:zhaolei 來源: ccw
相關(guān)推薦

2011-03-31 11:14:29

MRTG監(jiān)測

2011-03-31 11:20:10

MRTG監(jiān)測

2011-03-31 11:14:29

MRTG監(jiān)測

2011-03-31 11:14:28

2011-03-30 11:30:31

MRTG

2011-04-02 11:40:11

mrtg監(jiān)控

2011-03-30 11:31:10

MRTG

2011-03-30 11:31:10

MRTG

2011-04-01 09:18:04

mrtg流量

2011-03-30 11:34:26

流量MRTG

2011-03-30 13:29:55

MRTG

2011-04-06 11:36:30

MRTG監(jiān)控內(nèi)存

2011-03-30 11:31:10

MRTG

2011-03-30 13:29:49

MRTG

2011-03-31 09:02:18

MRTG流量

2011-03-31 10:24:15

2010-01-27 10:01:20

2011-04-06 13:50:34

LinuxMRTG監(jiān)控

2011-04-01 15:05:45

Redhat配置mrtg

2010-05-31 19:56:26

Ubuntu mrtg
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號