公司的監控系統使用的nagios,而外網通路nagios使用的域名形式。内網使用nginx進行反向代理到nagios所在的伺服器。
nginx的反向代理與域名配置如下:
[root@lzmail vhosts]# more test.ilanni.com.conf
server
{
listen 80;
server_name test.ilanni.com;
index index.html index.htm index.php index.cgi;
location /nagios{
proxy_pass http://192.168.0.1:81/nagios/;
}
proxy_set_header x-real-ip $remote_addr;
proxy_set_header remote-host $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
access_log /var/log/test.ilanni.com.log main;
今天沒事就看看nagios日志記錄相關的資訊,分析使用者的行為。
我們可以通過tail –f /var/log/test.ilanni.com動态分析。

120.204.200.21 – – [07/jun/2014:17:21:17 +0800] get / http/1.1 “200” 555 “-” “dnspod-monitor/1.0” “-”
101.71.38.76 – nagiosadmin [07/jun/2014:17:21:26 +0800] get /nagios/cgi-bin/extinfo.cgi?type=2&host=gs_1.11mail&service=check_cpu http/1.1 “200” 2709 “-” “mozilla/5.0 (compatible; msie 10.0; windows nt 6.2; wow64; trident/6.0)” “-”
101.71.37.62 – nagiosadmin [07/jun/2014:17:21:26 +0800] get /nagios/stylesheets/common.css http/1.1 “304” 0 “http://test.ilanni.com/nagios/cgi-bin/extinfo.cgi?type=2&host=gs_1.11mail&service=check_cpu” “mozilla/5.0 (compatible; msie 10.0; windows nt 6.2; wow64; trident/6.0)” “-“
以上是這個日志的其中一條記錄。
101.71.37.62記錄的通路者的ip位址,這個是通過nginx的反向代理配置中的proxy_set_header x-real-ip $remote_addr;獲得。
nagiosadmin記錄的是遠端使用者。
這個ip位址其實我自己,而我目前通路的網頁是nagios監控一個主機的cpu項目,如下:
get /nagios/stylesheets/common.css http/1.1 “304” 0 “http://test.ilanni.com/nagios/cgi-bin/extinfo.cgi?type=2&host=gs_1.11mail&service=check_cpu“
這個記錄的是使用者正在通路的網頁。對比我上邊的通路網頁截圖,很容易能看到我通路的确實是主機192.168.1.11的cpu監控項。
繼續向下看:
mozilla/5.0 (compatible; msie 10.0; windows nt 6.2; wow64; trident/6.0)
這個記錄的是通路者浏覽器及作業系統的相關資訊。
其中msie 10表示通過ie 10進行通路的。這個和我本機的ie 10剛好相符,如下:
windows nt 6.2表示通路者使用的是os版本,nt6.2是win8系統。
而我的本本确實是win8系統,核心版本确實是nt 6.2,如下圖:
wow64表示os是64bit系統,本本的系統版本如下圖:
通過上述分析,我們可以得到如下的資訊:
nagiosadmin使用者使用win8 64bit系統通過ie10浏覽器正在通路nagios的一個check_cpu監控項目。