煮酒品茶:cwtea.blog.51cto.com
創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),綏濱企業(yè)網(wǎng)站建設(shè),綏濱品牌網(wǎng)站建設(shè),網(wǎng)站定制,綏濱網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,綏濱網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。
#yum intsall -y httpd php gcc make |
tar zxvf nagios-3.5.0rc2.tar.gz |
cd nagios |
./configure --prefix=/usr/local/nagios
make all make install useradd nagios #把nagios加入到apache組。 usermod -G nagios apache make install make install-init make install-commandmode make install-config make install-webconf |
./configure --prefix=/usr/local/nagios
make make install |
Creating sample config files in sample-config/ ...
*** Configuration summary for nagios 3.5.0rc2 03-09-2013 ***: General Options: ------------------------- Nagios executable: nagios Nagios user/group: nagios,nagios Command user/group: nagios,nagios Embedded Perl: no Event Broker: yes Install ${prefix}: /usr/local/nagios #PID號 Lock file: ${prefix}/var/nagios.lock #檢查結(jié)果目錄 Check result directory: ${prefix}/var/spool/checkresults #服務(wù)配置目錄 Init directory: /etc/rc.d/init.d #apache for nagios目錄 Apache conf.d directory: /etc/httpd/conf.d #mail程序 Mail program: /bin/mail #主機名 Host OS: linux-gnu Web Interface Options: ------------------------ HTML URL: http://localhost/nagios/ CGI URL: http://localhost/nagios/cgi-bin/ Traceroute (used by WAP): Review the options above for accuracy. If they look okay, type 'make all' to compile the main program and CGIs. |
*** Compile finished ***
If the main program and CGIs compiled without any errors, you can continue with installing Nagios as follows (type 'make' without any arguments for a list of all possible options): make install - This installs the main program, CGIs, and HTML files #安裝主程序,CGI文件和Html文件。 make install-init - This installs the init script in /etc/rc.d/init.d #安裝nagios服務(wù),腳本在/etc/rc.d/init.d/nagios make install-commandmode - This installs and configures permissions on the directory for holding the external command file #安裝和配置權(quán)限在外部命令目錄 make install-config - This installs *SAMPLE* config files in /usr/local/nagios/etc You'll have to modify these sample files before you can use Nagios. Read the HTML documentation for more info on doing this. Pay particular attention to the docs on object configuration files, as they determine what/how things get monitored! #把樣版配置文件拷到/usr/local/nagios/etc目錄。 make install-webconf - This installs the Apache config file for the Nagios web interface #安裝apache配置nagios選項文件。yum安裝會創(chuàng)建/etc/http/conf.d/nagios.cfg make install-exfoliation - This installs the Exfoliation theme for the Nagios web interface #主題 make install-classicui - This installs the classic theme for the Nagios web interface #經(jīng)典主題 |
# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005 # # This file contains examples of entries that need # to be incorporated into your Apache web server # configuration file. Customize the paths, etc. as # needed to fit your system. ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin" <Directory "/usr/local/nagios/sbin"> # SSLRequireSSL Options ExecCGI AllowOverride None Order allow,deny Allow from all # Order deny,allow # Deny from all # Allow from 127.0.0.1 AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory> Alias /nagios "/usr/local/nagios/share" <Directory "/usr/local/nagios/share"> # SSLRequireSSL Options None AllowOverride None Order allow,deny Allow from all # Order deny,allow # Deny from all # Allow from 127.0.0.1 AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory> |
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. |
[Fri Mar 15 00:22:46 2013] [error] [client 192.168.100.80] (13)Permission denied: exec of '/usr/local/nagios/sbin/status.cgi' failed, referer: http://192.168.100.84/nagios/side.php |
It appears as though you do not have permission to view information for any of the services you requested... |
authorized_for_system_information=cwtea
authorized_for_configuration_information=cwtea authorized_for_system_commands=cwtea authorized_for_all_services=cwtea authorized_for_all_hosts=cwtea authorized_for_all_service_commands=cwtea authorized_for_all_host_commands=cwtea |
#hostgroup
define hostgroup { hostgroup_name ktm-server alias ktm server members nagios-server } #host define host { host_name nagios-server alias nagios server address 192.168.100.85 contact_groups ktm check_command check-host-alive max_check_attempts 5 notification_interval 10 notification_period 24x7 notification_options d,u,r } #contact define contact { contact_name cwtea alias system administrator service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,u,r service_notification_commands notify-service-by-email host_notification_commands notify-host-by-email email zwhset@163.com pager 15010228888 } #contactgroup define contactgroup { contactgroup_name ktm alias system administrator members cwtea } |
#service in host
define service { host_name nagios-server service_description check-host-alive check_period 24x7 max_check_attempts 4 normal_check_interval 3 retry_check_interval 2 contact_groups ktm notification_interval 10 notification_period 24x7 notification_options w,u,c,r check_command check-host-alive } |
cfg_file=/usr/local/nagios/etc/objects/hc.cfg
cfg_file=/usr/local/nagios/etc/objects/service.cfg #add # #cfg_file=/usr/local/nagios/etc/objects/localhost.cfg |
.
├── archives ├── nagios.lock #PID號保存文件。 ├── nagios.log #當(dāng)然是日志啦。 ├── objects.cache #當(dāng)你查看這個文件,你就會喜歡上他了。緩存的,看下面解釋。 ├── retention.dat #上面緩存一個,這里又保留一個。好兄弟要哥倆啊。 ├── rw │?? └── nagios.cmd #看下面解決。 ├── spool │?? └── checkresults #這個文件夾在工作的時候會經(jīng)常寫冊文件,這當(dāng)然是在采集數(shù)據(jù)存放于此。 └── status.dat #這個就有意思了,網(wǎng)站讀的就是這個文件,service模塊下有個performance_data=rta=0.497000ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0,對比網(wǎng)站上的是不是一樣? |
# OBJECT CACHE FILE
# This option determines where object definitions are cached when # Nagios starts/restarts. The CGIs read object definitions from # this cache file (rather than looking at the object config files # directly) in order to prevent inconsistencies that can occur # when the config files are modified after Nagios starts. 對象緩存文件。這些選項將決定當(dāng)Nagios啟動時或重新啟動時,對象定義將被緩存在什么地方。CGI將從這個對象文件中讀取對象的定義,而不是在之前的對象配置文件路徑中去找。這樣做是為了避免修改Nagios配置文件后引起的不一致問題。換句簡單的話說就是更改配置文件后要重新運新Nagios新的配置參數(shù)才會生效,而當(dāng)前運行的Nagios只參考緩存中的配置參數(shù)而已。 object_cache_file=/var/log/nagios/objects.cache |
# EXTERNAL COMMAND FILE
# This is the file that Nagios checks for external command requests. # It is also where the command CGI will write commands that are submitted # by users, so it must be writeable by the user that the web server # is running as (usually 'nobody'). Permissions should be set at the # directory level instead of on the file, as the file is deleted every # time its contents are processed. 這是Nagios用來檢查外部命令請求的文件。這個文件同樣也是用戶操作提交與CGI命令寫入的地方,所以這個文件必須對于相關(guān)服務(wù)可寫,一般是針對Apache的宿主用戶可寫。并且注意,這個文件所在的目錄的權(quán)限必須被Apache可寫,而不單指這文件,因為這個文件在工作當(dāng)中是頻繁被刪除的。(之前我們將Apahe歸入Nagios組的時候就已經(jīng)完成了) command_file=/var/log/nagios/rw/nagios.cmd |
# STATUS FILE
# This is where the current status of all monitored services and # hosts is stored. Its contents are read and processed by the CGIs. # The contents of the status file are deleted every time Nagios # restarts. 狀態(tài)文件。這個文件將保存著目前檢測到的服務(wù)和主機數(shù)據(jù)信息。這個文件當(dāng)中的內(nèi)容是被CGI讀取并處理的,而它也是在每次Nagios重新啟動的時候被刪除清空的。 status_file=/var/log/nagios/status.dat |
.
├── nagios #這個是啟動文件 └── nagiostats #運行一下這個,你會發(fā)現(xiàn)世界是多么的精彩。這個不就是nagios web界面上的信息嗎?他也是采集這個文件。 |
#網(wǎng)上找的說明,難得敲字。
bin Nagios執(zhí)行程序所在目錄,nagios文件即為主程序 etc Nagios配置文件位置,初始安裝完后,只有幾個*.cfg-sample文件 sbin Nagios Cgi文件所在目錄,也就是執(zhí)行外部命令所需文件所在的目錄 Share Nagios網(wǎng)頁文件所在的目錄 Var Nagios日志文件、spid 等文件所在的目錄 |
//$corewindow="main.php";
$corewindow="cgi-bin/status.cgi"; |
當(dāng)前文章:Nagios安裝真可愛
文章轉(zhuǎn)載:http://muchs.cn/article32/gheisc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、服務(wù)器托管、網(wǎng)站策劃、網(wǎng)站內(nèi)鏈、營銷型網(wǎng)站建設(shè)、網(wǎng)站設(shè)計公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)