<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_草原和大树</title><subtitle type="text">没落的帝王向往草原大树的生活</subtitle><id>http://feed.cnblogs.com/blog/u/39982/rss</id><updated>2012-05-25T03:47:13Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/39982/rss"/><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/25/2517783.html</id><title type="text">查看linux机器是32位还是64位的方法</title><summary type="text">查看linux机器是32位还是64位的方法：file /sbin/init 或者 file /bin/ls/sbin/init: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped如果显示 64-bit 则为64位；file /sbin/init/sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Li</summary><published>2012-05-25T03:47:00Z</published><updated>2012-05-25T03:47:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/25/2517783.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/25/2517783.html"/><content type="html">&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;查看linux机器是32位还是64位的方法：&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;file /sbin/init 或者 file /bin/ls&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;/sbin/init: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;如果显示 64-bit 则为64位；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;file /sbin/init&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;/sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;如果显示为32 bit 则为32bit；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;uname -a:&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;uname -a&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;Linux pmx002**.**.**&amp;nbsp; 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;x86_64表示64位机器&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;uname -a&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;Linux pmx0**.**.**&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386 GNU/Linux&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;i686表示32位机器&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;i686 只是i386的一个子集,支持的cpu从Pentium 2 (686)开始,之前的型号不支持.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;备注：&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;1. i386 适用于intel和AMD所有32位的cpu.以及via采用X86架构的32的cpu.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;intel平台包括8086,80286,80386,80486,奔腾系列(1.2.3.4)、赛扬系列,Pentium D系列&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 以及centrino P-M,core duo 等.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;2. X86_64 适用于intel的Core 2 Duo, Centrino Core 2 Duo, and Xeon 和AMD Athlon64/x2, Sempron64/x2, Duron64等采用X86架构的64位cpu.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;3. PPC&amp;nbsp;&amp;nbsp; 适用于Apple Macintosh G3, G4, G5, PowerBook, and other non-Intel models&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;安装DVD包括的软件要比安装光盘多一些,安装DVD也包括了两种图形界面(KDE和gnome).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;4.Jigdo&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;也可以通过 Jigdo 下载 Fedora 发行版。Jigdo 可以加速下载安装盘的 ISO 镜像。同 BT 下载等待任务完全完成所不同，Jidgo 自动定位最快的镜像服务器(通过 Fedora 镜像管理器)，并且从中下载所需要的文件。为了减少所需的网络流量，可以让 Jigdo 扫描现存的 DVD 或 CD 介质。这个功能对于以下用户特别有用。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;getconf LONG_BIT&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;在32位和64位机器上运行如下命令，结果如下：&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;[b@002 ~]$ getconf LONG_BIT&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;64&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;[root@pmx4 /]# getconf LONG_BIT&lt;/span&gt;&lt;br style="margin: 0px; padding: 0px; " /&gt;&lt;span style="margin: 0px; padding: 0px; font-size: 20px; line-height: 1.8em; "&gt;32&lt;/span&gt;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2517783.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/25/2517783.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/11/2495423.html</id><title type="text">shell 中的不相等怎么表达？大于、小于又怎么表达？</title><summary type="text">都是英文缩写，知道英文含义就很好记。 不相等 -ne （not equal） 大于 -gt (greater than) 小于 -lt (less than) 大于或等于 -ge (greater than or equal) 小于或等于 -le (less than or equal)</summary><published>2012-05-11T01:39:00Z</published><updated>2012-05-11T01:39:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/11/2495423.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/11/2495423.html"/><content type="html">都是英文缩写，知道英文含义就很好记。 不相等 -ne    （not equal） 大于 -gt       (greater than) 小于 -lt      (less than) 大于或等于 -ge      (greater than or equal) 小于或等于 -le        (less than or equal)&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2495423.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/11/2495423.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/10/2493785.html</id><title type="text">如何编写 Nagios 插件 (http://zener.blog.51cto.com/937811/727685)</title><summary type="text">如何编写 Nagios 插件Nagios 的最激动人心的方面是可以轻松地编写您自己的插件，只需要了解一些简单的指导原则即可。为了管理插件，Nagios 每次在查询一个服务的状态时，产生一个子进程，并且它使用来自该命令的输出和退出代码来确定具体的状态。退出状态代码的含义如下所示：OK—退出代码 0—表示服务正常地工作。WARNING—退出代码 1—表示服务处于警告状态。CRITICAL—退出代码 2—表示服务处于危险状态。UNKNOWN—退出代码 3—表示服务处于未知状态。最后一种状态通常表示该插件无法确定服务的状态。例如，可能出现了内部错误。下面提供了一个 Python 示例脚本，用于检查 U</summary><published>2012-05-10T01:49:00Z</published><updated>2012-05-10T01:49:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/10/2493785.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/10/2493785.html"/><content type="html">&lt;p&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; font-size: 12px; "&gt;&lt;a name="N10144" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 1.5em; font-weight: bold; "&gt;如何编写 Nagios 插件&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Nagios 的最激动人心的方面是可以轻松地编写您自己的插件，只需要了解一些简单的指导原则即可。为了管理插件，Nagios 每次在查询一个服务的状态时，产生一个子进程，并且它使用来自该命令的输出和退出代码来确定具体的状态。退出状态代码的含义如下所示：&lt;/p&gt;&lt;ul style="padding-top: 0px; padding-right: 5px; padding-bottom: 5px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; font-size: 0.76em; "&gt;&lt;li style="padding-top: 0px; padding-right: 5px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-family: arial, nsimsun, sans-serif; "&gt;&lt;strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;OK&lt;/strong&gt;&amp;nbsp;&amp;#8212;退出代码 0&amp;#8212;表示服务正常地工作。&lt;/li&gt;&lt;li style="padding-top: 0px; padding-right: 5px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-family: arial, nsimsun, sans-serif; "&gt;&lt;strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;WARNING&lt;/strong&gt;&amp;nbsp;&amp;#8212;退出代码 1&amp;#8212;表示服务处于警告状态。&lt;/li&gt;&lt;li style="padding-top: 0px; padding-right: 5px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-family: arial, nsimsun, sans-serif; "&gt;&lt;strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;CRITICAL&lt;/strong&gt;&amp;nbsp;&amp;#8212;退出代码 2&amp;#8212;表示服务处于危险状态。&lt;/li&gt;&lt;li style="padding-top: 0px; padding-right: 5px; padding-bottom: 3px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 20px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-family: arial, nsimsun, sans-serif; "&gt;&lt;strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;UNKNOWN&lt;/strong&gt;&amp;nbsp;&amp;#8212;退出代码 3&amp;#8212;表示服务处于未知状态。&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;最后一种状态通常表示该插件无法确定服务的状态。例如，可能出现了内部错误。&lt;/p&gt;&lt;p&gt;下面提供了一个 Python 示例脚本，用于检查 UNIX&amp;#174; 平均负载。它假定 2.0 以上的级别表示警告状态，而 5.0 以上的级别表示危险状态。这些值都采用了硬编码的方式，并且始终使用最近一分钟的平均负载。&lt;/p&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;a name="pythonplugin1" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;strong style="padding-top: 0.3em; padding-right: 5px; padding-bottom: 0.7em; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 0.76em; font-family: arial, sans-serif; "&gt;清单 5. Python 插件&amp;#8212;示例工作插件&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;                 #!/usr/bin/env python  import os,sys  (d1, d2, d3) = os.getloadavg()  if d1 &amp;gt;= 5.0:     print "GETLOADAVG CRITICAL: Load average is %.2f" % (d1)     sys.exit(2) elif d1 &amp;gt;= 2.0:     print "GETLOADAVG WARNING: Load average is %.2f" % (d1)     sys.exit(1) else:     print "GETLOADAVG OK: Load average is %.2f" % (d1)     sys.exit(0)     &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;在编写了这个小的可执行插件之后，接下来是使用 Nagios 注册该插件，并创建一个检查平均负载的服务定义。&lt;/p&gt;&lt;p&gt;这项工作也是非常简单的：使用下面的内容创建一个名为&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;/etc/nagios-plugins/config/mygetloadavg.cfg&lt;/code&gt;&amp;nbsp;的文件，根据下面的示例，向&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;services.cfg&lt;/code&gt;&amp;nbsp;文件添加一个服务。请记住，必须在&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;hosts.cfg&lt;/code&gt;&amp;nbsp;配置文件中定义&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;localhost&lt;/code&gt;。&lt;/p&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;a name="list6" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;strong style="padding-top: 0.3em; padding-right: 5px; padding-bottom: 0.7em; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 0.76em; font-family: arial, sans-serif; "&gt;清单 6. 示例插件&amp;#8212;使用 Nagios 进行注册&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;                 define command{         command_name    check_mygetloadavg command_line    /path/to/check_getloadavg } &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;a name="list7" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;strong style="padding-top: 0.3em; padding-right: 5px; padding-bottom: 0.7em; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 0.76em; font-family: arial, sans-serif; "&gt;清单 7. 创建一个使用示例插件的服务&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;                 define service{         use                             service-template         host_name                       localhost         service_description             LoadAverage         check_period                    24x7         contact_groups                  server-admins         notification_options            c,r         check_command                   check_mygetloadavg         } &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a name="N101A6" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 1.5em; font-weight: bold; "&gt;编写一个完整的插件&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;前面的示例说明了一个采用&amp;#8220;硬编码&amp;#8221;方式插件的限制，它不支持运行时配置。在实际中，通常最好的方式是创建一个可配置的插件。通过这种方式，您可以创建和维护一个插件，使用 Nagios 将其注册为单个插件，并且传递参数以便为特定的情况自定义警告和危险水平。下一个示例还包括一则使用消息；经过证实，对于由几个不同的开发人员或者管理员所使用或维护的插件，这是非常有价值的。&lt;/p&gt;&lt;p&gt;另一个好的实践是捕获所有的异常，并后退以报告 UNKNOWN 服务状态，以便 Nagios 能够正确地管理有关这个情况的通知。那些允许异常&amp;#8220;失败&amp;#8221;的插件通常会退出，并返回值 1；对于 Nagios，这表示一个 WARNING 状态。请确保您的插件能够正确地区分 WARNING 和 UNKNOWN。请注意，例如，在将其作为 UNKNOWN 结果处理可能出现错误的情况下，通常可以禁用至少某些 WARNING 通知。&lt;/p&gt;&lt;p&gt;&lt;a name="N101B3" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 1.5em; font-weight: bold; "&gt;用 Python 编写一个插件&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;上述的建议&amp;#8212;运行时参数化、一则使用消息，以及经过改进的异常处理&amp;#8212;将得到示例插件的源代码，这段代码要比前面的长几倍。但是您可以更安全地对错误进行处理，并且能够在更广泛的范围内重用该插件。&lt;/p&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;a name="list8" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;strong style="padding-top: 0.3em; padding-right: 5px; padding-bottom: 0.7em; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 0.76em; font-family: arial, sans-serif; "&gt;清单 8. Python 插件&amp;#8212;获取平均负载的完整插件&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;                 #!/usr/bin/env python  import os import sys import getopt  def usage():     print """Usage: check_getloadavg [-h|--help] [-m|--mode 1|2|3] \     [-w|--warning level] [-c|--critical level]"  Mode: 1 - last minute ; 2 - last 5 minutes ; 3 - last 15 minutes" Warning level defaults to 2.0 Critical level defaults to 5.0"""     sys.exit(3)  try:     options, args = getopt.getopt(sys.argv[1:],         "hm:w:c:",         "--help --mode= --warning= --critical=",         ) except getopt.GetoptError:     usage()     sys.exit(3)  argMode = "1" argWarning = 2.0 argCritical = 5.0  for name, value in options:     if name in ("-h", "--help"):         usage()     if name in ("-m", "--mode"):         if value not in ("1", "2", "3"):             usage()         argMode = value     if name in ("-w", "--warning"):         try:             argWarning = 0.0 + value         except Exception:             print "Unable to convert to floating point value\n"             usage()     if name in ("-c", "--critical"):         try:             argCritical = 0.0 + value         except Exception:             print "Unable to convert to floating point value\n"             usage()  try:     (d1, d2, d3) = os.getloadavg() except Exception:     print "GETLOADAVG UNKNOWN: Error while getting load average"     sys.exit(3)  if argMode == "1":     d = d1 elif argMode == "2":     d = d2 elif argMode == "3":     d = d3  if d &amp;gt;= argCritical:     print "GETLOADAVG CRITICAL: Load average is %.2f" % (d)     sys.exit(2) elif d &amp;gt;= argWarning:     print "GETLOADAVG WARNING: Load average is %.2f" % (d)     sys.exit(1) else:     print "GETLOADAVG OK: Load average is %.2f" % (d)     sys.exit(0)     &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;为了使用这个新的插件，需要使用下面的方法来注册&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;/etc/nagios-plugins/config/mygetloadavg2.cfg&lt;/code&gt;：&lt;/p&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;a name="list9" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;strong style="padding-top: 0.3em; padding-right: 5px; padding-bottom: 0.7em; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 0.76em; font-family: arial, sans-serif; "&gt;清单 9. Python 插件&amp;#8212;使用 Nagios 进行注册&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;                 define command{         command_name    check_mygetloadavg2 command_line    /path/to/check_getloadavg2 -m $ARG1$ -w $ARG2$ -c $ARG3$ } &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;另外，根据下面的示例，在&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;services.cfg&lt;/code&gt;&amp;nbsp;文件中添加或者更改服务条目。请注意，使用感叹号&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;!&lt;/code&gt;&amp;nbsp;来分隔插件参数。与前面一样，必须在&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;hosts.cfg&lt;/code&gt;&amp;nbsp;配置文件中定义&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;localhost&lt;/code&gt;。&lt;/p&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;a name="list10" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;strong style="padding-top: 0.3em; padding-right: 5px; padding-bottom: 0.7em; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 0.76em; font-family: arial, sans-serif; "&gt;清单 10. 创建一个使用 Python 插件的服务&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;                 define service{         use                             service-template         host_name                       localhost         service_description             LoadAverage2         check_period                    24x7         contact_groups                  server-admins         notification_options            c,r         check_command                   check_mygetloadavg2!1!3.0!6.0         } &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a name="N101F5" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 1.5em; font-weight: bold; "&gt;用 Tcl 编写一个插件&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;最后的示例是使用 Tcl 编写的一个插件，它使用简单对象访问协议 (SOAP) 和 Web 服务描述语言 (WSDL) 检查 xmenthods.net 的汇率。SOAP 为该插件提供了汇率的当前值，并将这些值与配置的范围进行比较。如果该值不属于警告的范围，那么它将被认为是 OK。如果该值大于或者小于警告级别，但是并没有超过危险极限，则将状态设置为 WARNING。否则将其设置为 CRITICAL，除非出现了网络错误，在这种情况下将状态设置为 UNKNOWN。&lt;/p&gt;&lt;p&gt;该插件可以识别不同的可配置参数，以便能够检查不同范围的汇率。它还可以用于检查各个国家的各种汇率。&lt;/p&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;a name="list11" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;strong style="padding-top: 0.3em; padding-right: 5px; padding-bottom: 0.7em; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 0.76em; font-family: arial, sans-serif; "&gt;清单 11. Tcl 插件&amp;#8212;验证当前汇率&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;                 #!/usr/bin/env tclsh  # parse arguments package require cmdline set options {     {country1.arg "" "Country 1"}     {country2.arg "" "Country 2"}     {lowerwarning.arg "" "Lower warning limit"}     {upperwarning.arg "" "Upper warning limit"}     {lowercritical.arg "" "Lower critical limit"}     {uppercritical.arg "" "Upper critical limit"} }  array set opt [cmdline::getoptions argv $options {: [options]}]  # if the user did not supply all arguments, show help message for each necessary [array names opt] {     if {$opt($necessary) == ""} {         set argv "-help"         catch {cmdline::getoptions argv $options {: [options]}} usage puts stderr $usage         exit 3     } }  # load TclWebServices package package require WS::Client  if {[catch {     # download WSDL     WS::Client::GetAndParseWsdl \         http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl \ {} currency      # create stub commands     WS::Client::CreateStubs currency      # download the actual exchange rate     set result [lindex \         [currency::getRate "England" "Japan"] 1] } error]} {     # if downloading the rate failed for some reason, report it     puts "EXCHANGERATE UNKNOWN: $error"     exit 3 }      if {($result &amp;lt; $opt(lowercritical)) || ($result &amp;gt; $opt(uppercritical))} {     puts "EXCHANGERATE CRITICAL: rate is $result"     exit 2 } if {($result &amp;lt; $opt(lowerwarning)) || ($result &amp;gt; $opt(upperwarning))} {     puts "EXCHANGERATE WARNING: rate is $result"     exit 1 } puts "EXCHANGERATE OK: rate is $result" exit 0     &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;现在，您需要注册这个命令，以便 Nagios 知道如何调用它。为了完成这项工作，可以使用与前面类似的配置和命令定义来创建一个名为&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;/etc/nagios-plugins/config/exchangerate.cfg&lt;/code&gt;&amp;nbsp;的文件：&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;command_line    /path/to/check_exchangerate -country1 $ARG1$ -country2 $ARG2$ -lowercritical \  $ARG3$ -lowerwarning $ARG4$ -upperwarning $ARG5$ -uppercritical $ARG6$&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;在下面的示例中，假定该命令的名称为&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;check_exchangerate&lt;/code&gt;。&lt;/p&gt;&lt;p&gt;接下来，创建一个使用刚刚创建的插件来监视汇率的服务。下面是服务定义，它将该服务与&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;localhost&lt;/code&gt;&amp;nbsp;服务器关联起来。尽管这个检查并不真正地关联于任何物理主机，但是需要将它绑定到一台主机。如果这个检查涉及到调用受信任的网络中的服务器的 SOAP 方法，那么您可以添加需要进行监视的实际服务器，并且在这个示例中，应该将服务绑定到该服务器。&lt;a href="http://www.ibm.com/developerworks/cn/aix/library/au-nagios/#list12" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #4c6e94; text-decoration: none; "&gt;清单 12&lt;/a&gt;&amp;nbsp;中的代码检查 英镑对日元的汇率，并验证汇率位于 225 到 275 之间。&lt;/p&gt;&lt;p&gt;&lt;br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /&gt;&lt;a name="list12" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;strong style="padding-top: 0.3em; padding-right: 5px; padding-bottom: 0.7em; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 0.76em; font-family: arial, sans-serif; "&gt;清单 12. 添加 Tcl 插件作为一个新的服务&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;table width="572" cellpadding="0" cellspacing="0" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 0.8em; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; background-color: #ffffff; "&gt;&lt;tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;td style="padding-top: 2px; padding-right: 2px; padding-bottom: 5px; padding-left: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: arial, nsimsun, sans-serif; background-color: #f7f7f7 !important; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "&gt;                 define service{         use                             service-template         host_name                       localhost         service_description             EXCHANGERATE         check_period                    24x7         contact_groups                  other-admins         notification_options            c,r         check_command                   check_exchangerate!England!Japan!200!225!275!300         } &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a name="N10237" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 1.5em; font-weight: bold; "&gt;结束语&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;您可以使用 Nagios 监视所有类型的硬件和软件。您可以编写自己的插件，这使得能够监视与 Nagios 服务器进行通信的各种对象。正如您可以使用管理命令行参数和退出状态的任何计算语言一样，存在各种各样的可能性。&lt;/p&gt;&lt;p&gt;高级系统管理员可以使用 Tcl 或者任何其他语言来扩展 SOAP 示例，以便与内部网 Web 服务进行通信，并编写插件以验证该服务行为的正确性。&lt;/p&gt;&lt;p&gt;还可以使用 C 插件或者将 C 嵌入到您最喜欢的动态语言中（对于 Python，使用&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;Pyinline&lt;/code&gt;；对于 Perl，使用&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;Inline&lt;/code&gt;&amp;nbsp;；或者对于 Tcl，使用&amp;nbsp;&lt;code style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: small !important; "&gt;Critcl&lt;/code&gt;），以便将您的操作系统的 C API 与您的插件（使用高级语言编写）组合在一起。&lt;/p&gt;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2493785.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/10/2493785.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/09/2492043.html</id><title type="text">Nagios的进程监控及eventhandler之实战</title><summary type="text">Nagios自身是不带任何功能的，要实现监控功能，我们必须安装插件（plugins），幸好，现在只要安装一个通用的plugin，就能实现大部分的监控功能。以下是安装plugin的步骤，一般在正常安装的时候都已经装上了。wgethttp://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.7.tar.gzcd ~/downloadstar xzf nagios-plugins-1.4.7.tar.gzcd nagios-plugins-1.4.7./configure –with-nagios-user=nagi</summary><published>2012-05-09T08:56:00Z</published><updated>2012-05-09T08:56:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/09/2492043.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/09/2492043.html"/><content type="html">&lt;p&gt;Nagios自身是不带任何功能的，要实现监控功能，我们必须安装插件（plugins），幸好，现在只要安装一个通用的plugin，就能实现大部分的&lt;/p&gt;&lt;p&gt;监控功能。&lt;br /&gt;以下是安装plugin的步骤，一般在正常安装的时候都已经装上了。&lt;br /&gt;wget&amp;nbsp;&lt;a href="http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.7.tar.gz" style="color: #0066ff; text-decoration: none; "&gt;http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.7.tar.gz&lt;/a&gt;&lt;br /&gt;cd ~/downloads&lt;br /&gt;tar xzf nagios-plugins-1.4.7.tar.gz&lt;br /&gt;cd nagios-plugins-1.4.7&lt;br /&gt;./configure &amp;#8211;with-nagios-user=nagios &amp;#8211;with-nagios-group=nagios&lt;br /&gt;make&lt;br /&gt;make install&lt;/p&gt;&lt;p&gt;这时候在/usr/local/nagios/下就会出现一个libexec文件夹，有很多自带的功能程序。我们自定义的功能，也可以放在这个文件夹下面。&lt;br /&gt;较常用的有chekc_http,check_disk，等等，如果我们想了解其用法，可以用./check_http -h的命令。&lt;br /&gt;这一次我要实现的功能，是监控某个进程是否还存在，如果不存在了，就执行某个shell，使之启动。在此处，要用到check_procs和&lt;/p&gt;&lt;p&gt;eventhandler，与eventhandler例子中的检查apache的状态略有不同，故记录下来，与有需要的朋友分享。&lt;/p&gt;&lt;p&gt;首先，因为check_procs要去检查进程，所以我们要给他root的权限。&lt;br /&gt;chown root check_procs&lt;br /&gt;chmod 555 check_procs&lt;br /&gt;接下来运行：&lt;br /&gt;./check_procs&lt;br /&gt;(应该显示为: PROCS OK: XX processes)&lt;br /&gt;我用ps aux|grep cypress，查找我想监控的进程，里面带有/usr/local/cypressTemp/javasdk/bin/java&lt;/p&gt;&lt;p&gt;再用./check_procs -h查看check_procs的用法。以下是几个sampler。&lt;br /&gt;Examples:&lt;br /&gt;&amp;nbsp;check_procs -w 2:2 -c 2:1024 -C portsentry&lt;br /&gt;&amp;nbsp; Warning if not two processes with command name portsentry.&lt;br /&gt;&amp;nbsp; Critical if &amp;lt; 2 or &amp;gt; 1024 processes&lt;/p&gt;&lt;p&gt;&amp;nbsp;check_procs -w 10 -a &amp;#8216;/usr/local/bin/perl&amp;#8217; -u root&lt;br /&gt;&amp;nbsp; Warning alert if &amp;gt; 10 processes with command arguments containing&lt;br /&gt;&amp;nbsp; &amp;#8216;/usr/local/bin/perl&amp;#8217; and owned by root&lt;/p&gt;&lt;p&gt;&amp;nbsp;check_procs -w 50000 -c 100000 &amp;#8211;metric=VSZ&lt;br /&gt;&amp;nbsp; Alert if vsz of any processes over 50K or 100K&lt;/p&gt;&lt;p&gt;&amp;nbsp;check_procs -w 10 -c 20 &amp;#8211;metric=CPU&lt;br /&gt;&amp;nbsp; Alert if cpu of any processes over 10%% or 20%%&lt;/p&gt;&lt;p&gt;根据以上的sampler,我就能写出service和command了。&lt;br /&gt;define service{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; host_name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; localhost&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; service_description&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; check-cypress&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; check_command&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; check_cypress&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; event_handler&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; restart-cypress&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max_check_attempts&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; normal_check_interval&amp;nbsp;&amp;nbsp; 3&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retry_check_interval&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; check_period&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24&amp;#215;7&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;define command{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; command_name&amp;nbsp;&amp;nbsp;&amp;nbsp; check_cypress&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; command_line&amp;nbsp;&amp;nbsp;&amp;nbsp; $USER1$/check_procs -c 1:1 -a &amp;#8216;/usr/local/cypressTemp/javasdk/bin/java&amp;#8217;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;check_procs -c 1:1 -a &amp;#8216;/usr/local/cypressTemp/javasdk/bin/java&amp;#8217;的意思为：如果进程中没有一条包&lt;/p&gt;&lt;p&gt;含&amp;#8217;/usr/local/cypressTemp/javasdk/bin/java&amp;#8217;，则状态为critical(c)。&lt;br /&gt;因为我们还需要对这个做出动作，所以要用到eventhandler。&lt;br /&gt;define command{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; command_name&amp;nbsp;&amp;nbsp;&amp;nbsp; restart-cypress&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; command_line&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/local/nagios/libexec/eventhandlers/restart-cypress&amp;nbsp; $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;然后去/usr/local/nagios/libexec/eventhandlers/ 编辑restart-cypress 文件，如下：&lt;/p&gt;&lt;p&gt;#!/bin/sh&lt;br /&gt;#&lt;br /&gt;# Event handler script for restarting the cypress server on the local machine&lt;br /&gt;#&lt;br /&gt;#&lt;/p&gt;&lt;p&gt;# What state is the search service in?&lt;br /&gt;/usr/bin/printf "We enter" &amp;gt;&amp;gt; /usr/local/nagios/var/Cypress.log&lt;br /&gt;yourdate=`date&amp;nbsp;&amp;nbsp; +%Y%m%d%H%M%S`&lt;br /&gt;case "$1" in&lt;br /&gt;OK)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The service just came back up, so don&amp;#8217;t do anything&amp;#8230;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/printf "check OK $yourdate \n" &amp;gt;&amp;gt; /usr/local/nagios/var/Cypress.log&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;CRITICAL)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Aha!&amp;nbsp; The cypress service appears to have a problem &amp;#8211; perhaps we should restart the server&amp;#8230;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/bin/printf " The cypress service appears to have a problem $yourdate \n " &amp;gt;&amp;gt; /usr/local/nagios/var/Cypress.log&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/local/cypressTemp/runsearch.sh&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;;&amp;nbsp;&lt;br /&gt;esac&lt;br /&gt;exit 0&lt;/p&gt;&lt;p&gt;以上的shell文件很简单，就是运行一个已经写好的shell脚本。这个例子很简单，如果学习过&lt;a href="http://www.nagios.org/" style="color: #0066ff; text-decoration: none; "&gt;www.nagios.org&lt;/a&gt;上的eventhandler例子后，会非&lt;/p&gt;&lt;p&gt;常容易理解，我把完整的过程写出来，只是想提供一个实际的例子给各位朋友参考。&lt;/p&gt;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2492043.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/09/2492043.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/09/2491511.html</id><title type="text">轻量级SSH终端 Mosh</title><summary type="text">http://www.oschina.net/p/mosh</summary><published>2012-05-09T03:58:00Z</published><updated>2012-05-09T03:58:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/09/2491511.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/09/2491511.html"/><content type="html">&lt;a href="http://www.oschina.net/p/mosh"&gt;http://www.oschina.net/p/mosh&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2491511.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/09/2491511.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/07/2487611.html</id><title type="text">NSClient++ 客户端程序说明</title><summary type="text">以下为需要修改NSClient++主配置文件%PROGRAMFILES%\NSClient++\NSC.ini其它地方保持默认即可;NRPEListener.dllNSClientListener.dll;NSCAAgent.dll;CheckWMI.dllFileLogger.dllCheckSystem.dllCheckDisk.dllCheckEventLog.dllCheckHelpers.dllpassword =12345port =12489allowed_hosts =192.168.1.31/24以下为服务端check_nt检查命令#检查本次系统启动总时间check_nt -</summary><published>2012-05-07T08:31:00Z</published><updated>2012-05-07T08:31:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/07/2487611.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/07/2487611.html"/><content type="html">&lt;p&gt;以下为需要修改&amp;nbsp;NSClient++&amp;nbsp;主配置文件&amp;nbsp;%PROGRAMFILES%\NSClient++\NSC.ini其它地方保持默认即可&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;table border="1" cellspacing="0" bordercolor="#000000" cellpadding="4" width="100%" style="table-layout: auto !important; "&gt;&lt;colgroup&gt;&lt;col width="256"&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="#000000" height="214" width="100%" style="font-size: 12px; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; "&gt;&lt;p&gt;&lt;strong&gt;;NRPEListener.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;NSClientListener.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;;NSCAAgent.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;;CheckWMI.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;FileLogger.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;CheckSystem.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;CheckDisk.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;CheckEventLog.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;CheckHelpers.dll&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;password =&amp;nbsp;12345&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;port =&amp;nbsp;12489&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;allowed_hosts =&amp;nbsp;192.168.1.31/24&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;以下为服务端check_nt&amp;nbsp;检查命令&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;#&amp;nbsp;检查本次系统启动总时间&lt;/p&gt;&lt;p&gt;&lt;strong&gt;check_nt -H 192.168.1.121 -p 12489 -s 12345 -v UPTIME&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;#&amp;nbsp;检查内存占用情况&lt;/p&gt;&lt;p&gt;&lt;strong&gt;check_nt -H 192.168.1.121 -p 12489 -s 12345 -v MEMUSE -w 80 -c 90&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;#&amp;nbsp;检查客户端版本信息&lt;/p&gt;&lt;p&gt;&lt;strong&gt;check_nt -H 192.168.1.121 -p 12489 -s 12345 -v CLIENTVERSION&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;#&amp;nbsp;检查5分钟内CPU占用情况&lt;/p&gt;&lt;p&gt;&lt;strong&gt;check_nt -H 192.168.1.121 -p 12489 -s 12345 -v CPULOAD -w 80 -c 90 -l 5,80,90&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;#&amp;nbsp;检查磁盘C占用情况&lt;/p&gt;&lt;p&gt;&lt;strong&gt;check_nt -H 192.168.1.121 -p 12489 -s 12345 -v USEDDISKSPACE -d SHOWALL -l C&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;#&amp;nbsp;检查服务状态&lt;/p&gt;&lt;p&gt;&lt;strong&gt;check_nt -H 192.168.1.121 -p 12489 -s 12345 -v SERVICESTATE -l Spooler -d SHOWALL&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;#&amp;nbsp;检查进程状态&lt;/p&gt;&lt;p&gt;&lt;strong&gt;check_nt -H 192.168.1.121 -p 12489 -s 12345 -v PROCSTATE -l spark.exe -d SHOWALL&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;#&amp;nbsp;查看所有进程列表&lt;/p&gt;&lt;p&gt;&lt;strong&gt;check_nt -H 192.168.1.121 -p 12489 -s 12345 -v INSTANCES -l process&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2487611.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/07/2487611.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/07/2487063.html</id><title type="text">nagios 中 check_load 的含义</title><summary type="text">例如check_load -w 15,10,5 -c 30,25,20这个命令的意义如下当1分钟多于15个进程等待,5分钟多于10个,15分钟多于5个则为warning状态当1分钟多于30个进程等待,5分钟多于25个,15分钟多于20个则为critical状态</summary><published>2012-05-07T02:58:00Z</published><updated>2012-05-07T02:58:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/07/2487063.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/07/2487063.html"/><content type="html">&lt;span style="color: #494949; font-family: simsun; text-align: left; background-color: #e0c3a1; "&gt;例如check_load -w 15,10,5 -c 30,25,20这个命令的意义如下&lt;/span&gt;&lt;br style="color: #494949; font-family: simsun; text-align: left; background-color: #e0c3a1; " /&gt;&lt;span style="color: #494949; font-family: simsun; text-align: left; background-color: #e0c3a1; "&gt;当1分钟多于15个进程等待,5分钟多于10个,15分钟多于5个则为warning状态&lt;/span&gt;&lt;br style="color: #494949; font-family: simsun; text-align: left; background-color: #e0c3a1; " /&gt;&lt;span style="color: #494949; font-family: simsun; text-align: left; background-color: #e0c3a1; "&gt;当1分钟多于30个进程等待,5分钟多于25个,15分钟多于20个则为critical状态&lt;/span&gt;&amp;nbsp;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2487063.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/07/2487063.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/02/2479017.html</id><title type="text">更改windows2003最大连接数的方法我们来增加连接数</title><summary type="text">XP和2003中的远程桌面功能非常方便，不像以往需要安装。所以我一直使用，不过由于只允许2个用户登陆，有些时候因为在公司连接后断开，同事在家里用 其他用户登陆后断开，我就不能连接了。总是报错“终端服务超过最大连接数”，这时候我和同事都不能登陆，有没有什么办法可以达到以下几个目的中的一个： 1、为账号设定权限，管理员登陆的时候强制注销多余的用户。 2、管理员登陆的时候自动接管在其他地方断开的状态（本来这个功能具备，但有些时候不行）。 3、不安装总段服务的时候增加连接数（不是临时授权）我们来增加连接数运行：services.msc，启用license logging。打开win2k3的控制面板中.</summary><published>2012-05-02T06:39:00Z</published><updated>2012-05-02T06:39:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/02/2479017.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/02/2479017.html"/><content type="html">&lt;span style="color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; background-color: #ffffff; "&gt;XP和2003中的远程桌面功能非常方便，不像以往需要安装。所以我一直使用，不过由于只允许2个用户登陆，有些时候因为在公司连接后断开，同事在家里用 其他用户登陆后断开，我就不能连接了。总是报错&amp;#8220;终端服务超过最大连接数&amp;#8221;，这时候我和同事都不能登陆，有没有什么办法可以达到以下几个目的中的一个： &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style="color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; " /&gt;&lt;span style="color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1、为账号设定权限，管理员登陆的时候强制注销多余的用户。&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style="color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; " /&gt;&lt;span style="color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2、管理员登陆的时候自动接管在其他地方断开的状态（本来这个功能具备，但有些时候不行）。&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style="color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; " /&gt;&lt;span style="color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3、不安装总段服务的时候增加连接数（不是临时授权）&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;我们来增加连接数&lt;/p&gt;&lt;p&gt;运行：services.msc，启用license logging。&lt;/p&gt;&lt;div forimg="1" align="center" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;img src="http://hiphotos.baidu.com/godox/pic/item/cee6fa64585666f7f736544f.jpg" border="0" small="0" width="580" height="420" style="border-style: initial; width: 580px; height: 420.9199318568995px; "  alt="" /&gt;&lt;/div&gt;&lt;div forimg="1" align="center" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;/div&gt;&lt;div forimg="1" align="left" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;打开win2k3的控制面板中的"授权"，点"添加许可"，输入要改的连接数。&lt;/div&gt;&lt;div forimg="1" align="left" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;/div&gt;&lt;div forimg="1" align="center" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;img src="http://hiphotos.baidu.com/godox/pic/item/e8cf00dabed127dcb6fd4848.jpg" border="0" small="0" style="border-style: initial; "  alt="" /&gt;&lt;/div&gt;&lt;div forimg="1" align="center" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;/div&gt;&lt;div forimg="1" align="left" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;/div&gt;&lt;div forimg="1" align="left" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;/div&gt;&lt;div forimg="1" align="center" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;img src="http://hiphotos.baidu.com/godox/pic/item/83f60366930d1723ab184c49.jpg" border="0" small="0" style="border-style: initial; "  alt="" /&gt;&lt;/div&gt;&lt;div forimg="1" align="center" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;/div&gt;&lt;div forimg="1" align="left" style="word-wrap: break-word; color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;p&gt;别忘了添加完毕后再关闭 License Logging。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;开始－运行－gpedit.msc－计算机配置－管理模板－windows组件－终端服务－会话&lt;br /&gt;右边窗口选择 为断开的会话设置时间限制 －选择已启用，选择一个时间&lt;br /&gt;问题解决&lt;br /&gt;&lt;br /&gt;另建议：&lt;br /&gt;开始－管理工具－终端服务配置－服务器配置－限制每个用户使用一个会话.&lt;/p&gt;&lt;p&gt;现象及原因：用远程桌面连接登录到终端服务器时经常会遇到&amp;#8220;终端服务器超出最大允许连接数&amp;#8221; 诸如此类错误导致无法正常登录终端服务器，引起该问题的原因在于Windows Server 2003中设置终端服务的缺省连接数为2个链接，并且当登录远程桌面后如果不是采用注销方式退出，而是直接关闭远程桌面窗口，那么实际上会话并没有释放 掉，而是继续保留在服务器端，这样就会占用总的链接数，当这个数量达到最大允许值时就会出现上面的提示。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;解决方案：&lt;br /&gt;法一：用&amp;#8220;注销&amp;#8221;方式退出远程桌面而不是直接关闭窗口&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;法二：踢出已经断开连接的用户&lt;br /&gt;1、首先telnet到此主机上(不管你用什么方法)，当然如果能直接操作机器更好，不过直接操作就不必用命令行了，用控制台更直观(略过)。&lt;br /&gt;&lt;br /&gt;2、Telnet上去后,先看登陆的用户：&lt;br /&gt;输入命令：query user 系统返回：&lt;br /&gt;用户名Username&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 会话名Session Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&amp;nbsp;&amp;nbsp; 状态State&amp;nbsp;&amp;nbsp;&amp;nbsp; 空闲时间Idle Time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 登录时间Logon Time&amp;nbsp;&lt;br /&gt;administrator&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 运行中&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2007-1-12 10:24&lt;br /&gt;lucy&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 唱片&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 无&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2007-1-12 10:35&lt;br /&gt;&amp;gt;administrator&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; rdp-tcp#35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 已断开&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2007-1-25 18:09&lt;br /&gt;此时可以看出的可能跟我的不一样，根据你的具体情况而定。&lt;br /&gt;ID 0 的用户是本地登陆的&lt;br /&gt;ID 1 和 ID 2是3389登陆的用户，前者在运行中， 后者已经断开了，但是断开了仍然占用系统资源和通道，我们要把它踢掉，如下进行操作即可。&lt;br /&gt;输入命令：logoff 1&amp;nbsp;&lt;br /&gt;&lt;br /&gt;再看看&lt;br /&gt;C:\Documents and Settings\Administrator.AD&amp;gt;query user&lt;br /&gt;用户名Username&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 会话名Session Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&amp;nbsp;&amp;nbsp; 状态State&amp;nbsp;&amp;nbsp;&amp;nbsp; 空闲时间Idle Time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 登录时间Logon Time&lt;br /&gt;administrator&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; console&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 运行中&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2007-1-12 10:24&lt;br /&gt;&amp;gt;administrator&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rdp-tcp#35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 已断开&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2007-1-25 18:09&lt;br /&gt;&lt;br /&gt;3、如果服务器关闭了telnet功能（这是默认的），还可以通过SqlServer的xp_cmdshell扩展存储过程，使用格式： master.dbo.xp_cmdshell ''''命令内容''''，其余可参考第二步。此方式要求有访问xp_cmdshell的权限。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;法三（最佳方法－推荐）：限制已断开链接的会话存在时间&lt;br /&gt;一般情况下，我们在维护远程服务器时，不可能长时间在线，但是系统默认的却是只要登录就不再断开。因此，我们可以修改这一默认设置，给它指定一个自动断开的时间即可。&lt;br /&gt;可以在Windows 2003 服务器上通过组策略中设置一下来解决问题：单击"开始&amp;#8594;运行"，输入"gpedit.msc"，回车后打开组策略窗口，然后依次定位到"计算机配置&amp;#8594;管理 模板&amp;#8594;Windows 组件&amp;#8594;终端服务&amp;#8594;会话"，然后在右侧窗口中双击"为断开的会话设置时间限制"，在打开的窗口中将"结束断开连接的会话"时间设置为5分钟，或者设置为空闲 就断开。&lt;br /&gt;或&lt;br /&gt;在远程服务器上打开&amp;#8220;运行&amp;#8221;窗口，输入&amp;#8220;tscc.msc&amp;#8221;连接设置窗口。然后双击&amp;#8220;连接&amp;#8221;项右侧的&amp;#8220;RDP-Tcp&amp;#8221;，切换到&amp;#8220;会话&amp;#8221;标签，选中&amp;#8220;替代用户设置&amp;#8221;选项，再给&amp;#8220;结束已断开的会话&amp;#8221;设置一个合适的时间即可。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;法四：增加连接数量，即设置可连接的数量多些&lt;br /&gt;默认情况下允许远程终端连接的数量是2个用户，我们可以根据需要适当增加远程连接同时在线的用户数。&lt;br /&gt;单击&amp;#8220;开始&amp;#8594;运行&amp;#8221;，输入&amp;#8220;gpedit.msc&amp;#8221;打开组策略编辑器窗口，依次定位到&amp;#8220;计算机配置&amp;#8594;管理模板&amp;#8594;Windows 组件&amp;#8594;终端服务&amp;#8221;，再双击右侧的&amp;#8220;限制连接数量&amp;#8221;，将其TS允许的最大连接数设置大一些即可。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;经过上面两个配置(法三&amp;amp;法四)，基本上就可以保证远程终端连接时不再受限。但仍有人反映，当前同时只有一个用户进行连接，却提示超出最大允许链 接数，这又是什么原因呢？出现这种情况是因为操作不当所造成的。在上一个帐户登录远程桌面后退出时，没有采用注销的方式，而是直接关闭远程桌面窗口，那么 导致该会话并没有被释放，而是继续保留在服务器端，占用了连接数，这样就会影响下一个用户的正常登录了。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;法五：限制用户会话数&lt;br /&gt;对Terminal Services进行限制，使得一个用户仅仅能够连接一次&lt;br /&gt;对于Windows Server 2003，请在Terminal Services Configuration（Terminal Services配置）中将&amp;#8220;限制每位用户只有拥有一个会话&amp;#8221;（Restrict each user to one session）设置为&amp;#8220;是&amp;#8221;（Yes）。此外，您可以将&amp;#8220;限制终端服务用户使用单个远程会话&amp;#8221;组策略设置为&amp;#8220;启用&amp;#8221;。&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="word-wrap: break-word; "&gt;&lt;p&gt;版本不一样解决的方法有异：&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A：这是因为Windows 2003中设置了最大允许连接数限制，而你每次连接后可能没有注销而是直接关 闭，导致连接数超过了最大连接数。你可以在Windows 2003 服务器上通过组策略中设置一下来解决问题：单击&amp;#8220;开始&amp;#8594;运行&amp;#8221;，输入 &amp;#8220;gpedit.msc&amp;#8221;，回车后打开组策略窗口，然后依次定位到&amp;#8220;计算机配置&amp;#8594;管理模板&amp;#8594;终端服务&amp;#8594;会话&amp;#8221;，然后在右侧窗口中双击&amp;#8220;为断开的会话设置时 间限制&amp;#8221;，在打开的窗口中将&amp;#8220;结束断开连接的会话&amp;#8221;时间设置为5分钟。最好的解决方法还是你每次断开连接时通过注销的方式。&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B：经常多人管理服务器的朋友一定遇到过当自己终端连接远程计算机的时候却提示&amp;#8220;终端连接超出了最大连接&amp;#8221;的提示吧？&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 这是因为windows2003仅支持2个终端用户的登陆。当这种情况出现后，多数人选择的是给机房打电话进行重启服务器。可是带来的损失也是显而 易见的。那么我们有什么办法来解决呢？方法当然是有的。我们只需要在一台2003的机器上运行&amp;#8220;tsmmc.msc&amp;#8221;就可以打开远程桌面连接，在这里我们 添加一个新的连接，输入对方的IP地址帐号和密码后就可以成功登陆到对方的桌面中，这时可以再踢下一个用户。就可以解决终端连接数超过最大的问题。&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; C：开始--控制面版---授权里面更改连接数&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2479017.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/02/2479017.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/05/02/2478534.html</id><title type="text">用pspasswd批量修改域内计算机本地管理员密码</title><summary type="text">使用说明：pspasswd \\远程计算机IP -u 域内有管理权限的用户名 -p 域内有管理权限用户的密码 远程计算机本地管理员账号 修改后的远程计算机本地管理员账号的密码password \\192.168.1.100 -u abc.com\Dadmin -p !@#123Qwe Administrator !@#$_ABcd如果一次修改的电脑较多，也可以使用IP列表来统一修改，如下：password \\c:\ip.txt -u abc.com\Dadmin -p !@#123Qwe Administrator !@#$_ABcdc:\ip.txt 文件中存放需要修改密码的计算机的IP地</summary><published>2012-05-02T01:47:00Z</published><updated>2012-05-02T01:47:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/05/02/2478534.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/05/02/2478534.html"/><content type="html">&lt;p&gt;&lt;strong&gt;&lt;p&gt;使用说明：&lt;br /&gt;pspasswd \\远程计算机IP -u 域内有管理权限的用户名 -p 域内有管理权限用户的密码 远程计算机本地管理员账号 修改后的远程计算机本地管理员账号的密码&lt;/p&gt;&lt;p&gt;password \\192.168.1.100 -u abc.com\Dadmin -p !@#123Qwe Administrator !@#$_ABcd&lt;/p&gt;&lt;p&gt;如果一次修改的电脑较多，也可以使用IP列表来统一修改，如下：&lt;br /&gt;password \\c:\ip.txt -u abc.com\Dadmin -p !@#123Qwe Administrator !@#$_ABcd&lt;br /&gt;c:\ip.txt 文件中存放需要修改密码的计算机的IP地址，每行一个地址。&lt;/p&gt;&lt;p&gt;以下是原文帮助&lt;br /&gt;PsPasswd v1.22 &amp;#8211; Local and remote password changer&lt;br /&gt;PsPasswd changes passwords on a local or remote system.&lt;/p&gt;&lt;p&gt;Usage: pspasswd [\\[computer[,computer,[,...]|Domain]|@file] [-u Username [-p Pa&lt;br /&gt;ssword]]] Username [NewPassword]&lt;br /&gt;computer&amp;nbsp;&amp;nbsp;&amp;nbsp; Direct PsPasswd to perform the command on the remote&lt;br /&gt;computer or computers specified. If you omit the computer&lt;br /&gt;name PsPasswd runs the command on the local system,&lt;br /&gt;and if you specify a wildcard (\\*), PsPasswd runs the&lt;br /&gt;command on all computers in the current domain.&lt;br /&gt;@file&amp;nbsp;&amp;nbsp;PsPasswd will change the password on the computers listed&lt;br /&gt;in the file.&lt;br /&gt;-u&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Specifies optional user name for login to remote&lt;br /&gt;computer.&lt;br /&gt;-p&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Specifies optional password for user name. If you omit this&lt;br /&gt;you will be prompted to enter a hidden password.&lt;br /&gt;Username&amp;nbsp;&amp;nbsp;&amp;nbsp; Specifies name of account for password change.&lt;br /&gt;NewPassword New password. If ommitted a NULL password is applied.&lt;/p&gt;&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2478534.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/05/02/2478534.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/JemBai/archive/2012/04/28/2474759.html</id><title type="text">apache代理</title><summary type="text">#vim /etc/http/conf.d/proxy_ajp.confProxyPass /nagios/ !ProxyPass / http://192.168.201.111/</summary><published>2012-04-28T02:56:00Z</published><updated>2012-04-28T02:56:00Z</updated><author><name>草原和大树</name><uri>http://www.cnblogs.com/JemBai/</uri></author><link rel="alternate" href="http://www.cnblogs.com/JemBai/archive/2012/04/28/2474759.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/JemBai/archive/2012/04/28/2474759.html"/><content type="html">&lt;div&gt;#vim /etc/http/conf.d/proxy_ajp.conf&amp;nbsp;&lt;/div&gt;&lt;p&gt;ProxyPass /nagios/ !&lt;/p&gt;&lt;div&gt;ProxyPass / &amp;nbsp; http://192.168.201.111/&lt;/div&gt;&lt;img src="http://www.cnblogs.com/JemBai/aggbug/2474759.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/JemBai/archive/2012/04/28/2474759.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry></feed>
