跳转到内容

使用 Xymon 进行系统监控 / 其他文档 / 常见问题解答

来自维基教科书,开放世界开放书籍

介绍性常见问题解答

[编辑 | 编辑源代码]

问:什么是 hobbit?

[编辑 | 编辑源代码]

答:Hobbit 是 Xymon 系统监控工具的旧名称。 http://www.hswn.dk/hobbit/help/about.html

问:什么是 Xymon?

[编辑 | 编辑源代码]

问:为什么我应该使用 Xymon 而不是 BB?

[编辑 | 编辑源代码]

用户常见问题解答

[编辑 | 编辑源代码]

下一个版本什么时候发布?

[编辑 | 编辑源代码]

答:Hobbit 是一个由 FOSS 项目,由 hobbit 开发者 在闲暇时间贡献。它处于积极开发中,但尚未宣布下一个版本的发布日期。如果需要,可以从 sourceforge 下载当前的开发快照。如果您正在追查某个特定错误修复或当前生产版本中不可用的功能,请搜索存档和/或向一般讨论邮件列表发布查询,以查看是否有可用的解决方案。您可以通过发送电子邮件至 [email protected] 订阅该列表。该列表的可搜索存档可在 http://www.hswn.dk/hobbiton/ 找到。

请订阅 hobbit 公告列表,以便在发布新版本时收到通知。您可以通过发送电子邮件至 [email protected] 订阅该列表。

该问题的另一个答案可在 http://www.hswn.dk/hobbiton/2008/02/msg00227.html 找到。

在哪里可以找到更多测试?

[编辑 | 编辑源代码]

答:Deadcat http://www.deadcat.net Deadcat 主要是 Big Brother 脚本,但它们中的大多数在 Hobbit 上无需过多调整即可运行。

The Shire Project (Xymonton) https://wiki.xymonton.org/doku.php Shire Project 专用于 Xymon(比 Deadcat 更好)

如何在 bb-hosts 文件中添加重复主机?

[编辑 | 编辑源代码]

答:主机的第一次出现与往常一样。所有后续出现的应该

  
0.0.0.0 hostname # noconn 

如果第一个 ping 没有响应,连接测试如何工作?

[编辑 | 编辑源代码]

答:bbtest-net 调用 hobbitping 或 fping(在 hobbitserver.cfg 中可配置为 FPING=)

同时发送多少个 ping?

[编辑 | 编辑源代码]

答:正在使用的并行连接数量完全取决于您的操作系统 -

   the default is FD_SETSIZE/4, which amounts to 256 on many Unix systems
   You can choose the number of concurrent connections with the "--concurrency=N" option to bbtest-net.

每次发送多少个数据包?

[编辑 | 编辑源代码]

答:hobbitping 通常在收到单个响应后停止 ping 主机,并使用它来确定往返时间。

ping 超时时间是多少?

[编辑 | 编辑源代码]

答:默认超时时间为 5 秒。

可以配置它吗?

[编辑 | 编辑源代码]

答:是的。hobbitping 的—timeout=N 参数允许您将超时时间设置为 N 秒。

连接测试(ping)的颜色代表什么?

[编辑 | 编辑源代码]

答:绿色表示正常响应,黄色表示有数据包丢失(不是延迟,只是丢失的数据包),红色表示没有响应。

如何让 hobbit 客户端从服务器下载 etc/hobbitclient.cfg(或 etc 或 ext 中的其他文件),然后重新启动?

[编辑 | 编辑源代码]

答:为什么?如果客户端设置为使用服务器端配置,它们甚至不需要本地 /etc/*.cfg 文件...

在 Hobbit 中是否有方法使用来自多个 RRD 文件的数据创建图表?

[编辑 | 编辑源代码]

答:如果您想使用多个 rrd 创建图表,我建议您使用名为 drraw 的第三方工具 http://web.taranis.org/drraw/

如何禁用 REPEAT 提醒?

[编辑 | 编辑源代码]

答:不设置 REPEAT= 会默认每 30 分钟重复提醒一次。设置 REPEAT=0 会默认每分钟重复一次。

  To disable repeat alerts, set REPEAT=365d 
  If your problem lasts that long, you have bigger problems than too many alerts.

从我的客户端发送的数据被截断了。

[编辑 | 编辑源代码]

A. 最大消息大小可以在 hobbitserver.cfg 中设置。

  MAXMSG_CLIENT= 
  MAXMSG_DATA= 
  MAXMSG_STATUS= 
  Change the above parameters to suit your needs.

编辑配置文件后,是否需要重新启动 Hobbit 服务器 ?

[编辑 | 编辑源代码]

A. 不需要。所有文件每 5 分钟重新读取一次。

  The only exception to this is hobbitserver.cfg Changes to this file require a restart.

在进行更改后,是否需要重新启动我的 Hobbit 客户端 ?

[编辑 | 编辑源代码]

A. 不需要。所有客户端配置文件会定期重新读取。

如何监控网页 ?

[编辑 | 编辑源代码]

A. 在 bb-hosts 文件中添加以下行

  ip.ad.dr.ress www.example.com # http://www.example.com/ 

或者对于 https

  ip.ad.dr.ress www.example.com # https://user:[email protected]/ 

请注意,还有内容检查以及发布和浏览器选项可用。有关详细信息,请参阅 bb-hosts(5) 手册的“HTTP 测试”部分。

我的测试每小时仅运行一次。如何让它在 30 分钟后不变成紫色 ?

[编辑 | 编辑源代码]

A. 有时您可能希望每小时(远程互联网站点)仅监控/测试一次,每天(备份作业或 DNS 更新)一次,甚至更少。或者也许更频繁(每分钟或更短时间测试一次关键连接)。

在客户端上使用 bb 报告状态时,有一个 LIFETIME 选项。它定义了状态消息被认为有效的持续时间(即新鲜且尚未陈旧)。在 bb 手册页 上搜索“LIFETIME”以获取更多信息。语法如下。

$BB $BBDISP "status+4h $MACHINE.$COLUMN $COLOR `date`

默认情况下,测试间隔为 5 分钟,状态生命周期为 30 分钟,因此默认情况下接受 5 次遗漏。应根据可接受的遗漏次数调整生命周期,否则可能会出现误报。例如,如果主机完全离线 2 小时,或者两次巧合地重叠每个小时的报告周期,那么每小时测试可能不需要立即调试。或者,对于每分钟测试一次的内容,30 分钟的生命周期可能需要向下调整。

几个示例场景

  • 如果脚本仅在备份完成时报告备份状态,并且主机或显示在那个确切时间不可用,那么该主机在该 NOC 中的备份状态可能需要或可能不需要变成紫色。
  • 如果脚本检查父目录中每个子目录的大小,并且状态更多地用于绘图而不是绿色/黄色/红色报告,那么许多遗漏可能是可以接受的。

警告:手册页建议“略大于测试之间的间隔”。但如果实际上遵循了这一点,那么默认超时将为 6 分钟。它不是 6,并且它不是为从 30 轻松更改而设计的:它不是配置文件中的选项,而是在 hobbitd/hobbitd.c 文件中的 handle_status 函数中硬编码的

int validity = 30;

Hobbit 是否对它的传输进行加密 ?

[编辑 | 编辑源代码]

A. 原生不支持。一些人报告使用外部加密成功。

  Later versions might support data encryption.

如何监控文件?我已经将 FILE /path/to/my/file 添加到 hobbitclient.cfg 中,但仍然没有反应。

[编辑 | 编辑源代码]

A.

您还需要将要监控的文件添加到 client-local.cfg 中(这会告诉客户端将文件元数据发送到服务器)然后服务器使用元数据和 hobbitclient.cfg 中的配置来确定测试结果。还要确保 hobbit 具有对文件的读取权限。

如何监控除默认日志文件之外的日志文件?

[编辑 | 编辑源代码]

答案 1

"Kauffman, Tom" <[email protected]> 
 
> On your hobbit server -
> 
> 1) set up etc/client-local.cfg to reference the logs you want AND any exclusions. For AIX, I have:
> [aix]
> log:/var/log/syslog:10240
>         ignore 3004-004
>         ignore 3004-035
>         ignore 3004
> log:/var/log/console.log:10240
> log:/var/log/dsmsched.log:10240
> 
> 2) set up etc/hobbit-clients.cfg to create your alerting criteria. For AIX, I've got these set:
> HOST=%.*
>         LOG /var/log/syslog %.*crit.su.*to.root red
>         LOG /var/log/syslog %.*crit.su   yellow
>         LOG %/var/(adm|log)/console.log %.*not.responding.still.trying yellow
> 
> 
> Change client-local.cfg first. Allow 15 to 20 minutes for this to propagate to the client;
> look for a file called logfetch.<hostname>.cfg in client/tmp. This should match your entries in
> client-local.cfg.
> 
> Once the logs started to coming in, play with the client-local.cfg and a test system, to track
> what you're interested in.
> 
> Tom

答案 2. 我已经将 LOG /path/to/my/logfile WARNING COLOR=yellow 添加到 hobbitclient.cfg 中,但仍然没有反应。

您还需要将要监控的日志文件添加到 client-local.cfg 中。这会告诉客户端将日志文件发送到服务器,因为 Hobbit 消息协议是双向的,而不仅仅是 hobbit 客户端向服务器发送消息。hobbit 服务器实际上可以指示 hobbit 客户端发送非默认日志文件。

  The server then uses the sent data and the config in hobbitclient.cfg to determine test results. 
  Also make sure hobbit has read access to the log.

一个 client-local.cfg 文件示例。

# following are by OS type to ask hobbit clients send in messages file.
[sunos]
log:/var/adm/messages:10240

[osf1]
log:/var/adm/messages:10240

[aix]
log:/var/adm/syslog/syslog.log:10240

[hp-ux]
log:/var/adm/syslog/syslog.log:10240

[win32]

[freebsd]
log:/var/log/messages:10240

[netbsd]
log:/var/log/messages:10240

[openbsd]
log:/var/log/messages:10240

[linux]
log:/var/log/messages:10240
dir:/tmp
ignore MARK

[linux22]
log:/var/log/messages:10240
ignore MARK

[redhat]
log:/var/log/messages:10240
ignore MARK

[debian]
log:/var/log/messages:10240
ignore MARK

[suse]
log:/var/log/messages:10240
ignore MARK

[mandrake]
log:/var/log/messages:10240
ignore MARK

[redhatAS]
log:/var/log/messages:10240
ignore MARK

[redhatES]
log:/var/log/messages:10240
ignore MARK

[rhel3]
log:/var/log/messages:10240
ignore MARK

[irix]
log:/var/adm/SYSLOG:10240

[darwin]
log:/var/log/system.log:10240

[sco_sv]
log:/var/adm/syslog:10240

# following are by machine names to ask hobbit clients send in messages file.
[caoffice2435.mainoffice.test.com]
log:/var/adm/messages:10240

[caoffice2436.mainoffice.test.com]
log:/var/adm/messages:10240

[caoffice2437.mainoffice.test.com]
log:/var/adm/messages:10240

[caoffice2444.mainoffice.test.com]
log:/var/adm/messages:10240

[caoffice2445.mainoffice.test.com]
log:/var/adm/messages:10240

[caoffice2141.comm.test.com]
# Solaris 10 OS log
#   "log:FILENAME:MAXDATA"
log:/var/adm/messages:10240
ignore MARK
# hobbit server logs
log:/var/opt/hobbitserver42/log/acknowledge.log:10240
log:/var/opt/hobbitserver42/log/bb-display.log:10240
log:/var/opt/hobbitserver42/log/bb-network.log:10240
log:/var/opt/hobbitserver42/log/bb-retest.log:10240
log:/var/opt/hobbitserver42/log/bbcombotest.log:10240
log:/var/opt/hobbitserver42/log/cgierror.log:10240
log:/var/opt/hobbitserver42/log/clientdata.log:10240
log:/var/opt/hobbitserver42/log/history.log:10240
log:/var/opt/hobbitserver42/log/hobbitd.log:10240
log:/var/opt/hobbitserver42/log/hobbitlaunch.log:10240
log:/var/opt/hobbitserver42/log/hostdata.log:10240
log:/var/opt/hobbitserver42/log/il02bbhostsallinone.ksh.log:10240
log:/var/opt/hobbitserver42/log/notifications.log:10240
log:/var/opt/hobbitserver42/log/page.log:10240
log:/var/opt/hobbitserver42/log/rrd-data.log:10240
log:/var/opt/hobbitserver42/log/rrd-status.log:10240
log:/var/opt/hobbitserver42/log/runwebalizer.log:10240

# httpd server logs
log:/var/opt/httpd222/log/access_log:102400
log:/var/opt/httpd222/log/error_log:102400

# httpd server logs
log:/var/log/maillog:102400

hobbit 警报电子邮件主题中的跟踪警报邮件号的含义是什么 ?

[编辑 | 编辑源代码]

A. 该数字是用于确认警报的确认代码。

  They are random numbers generated for each alert.

如何将对 Hobbit 页面的访问权限限制为特定人员或组 ?

[编辑 | 编辑源代码]

A. Apache 有自己的身份验证。使用它。

  To give one group access to some info, and another group access to other info, use the PAGE
  statement in bb-hosts. This will create a new directory for each page, which can be controlled
  by Apache's authentication system.

我在使用 devmon 时遇到了问题……

[编辑 | 编辑源代码]

A. 请将与 devmon 相关的问题发布到 devmon 支持邮件列表。

如何创建自定义脚本和图表 ?

[编辑 | 编辑源代码]

A. http://xymonton.org/tutorials:customgraph

[编辑 | 编辑源代码]

A. 对于表格来说,这是很常见的。必须将列名附加到 --multigraphs 设置中。

  1. 查看源文件 web/hobbitsvc.c
    • 找到 multigraphs 赋值并记下它的值。
  2. 编辑配置文件 server/etc/hobbitcgi.cfg
    1. 找到 CGI_SVC_OPTS 赋值。
    2. --multigraphs= 值添加到分配的字符串中,包括倾向于包含表格数据的列。例如
      CGI_SVC_OPTS="--env=/home/hobbit/server/etc/hobbitserver.cfg --no-svcid --history=top --multigraphs=disk,if_load,if_dsc"
      (请注意,尽管 hobbitsvc.c 中的设置以逗号开头和结尾,但 hobbitcgi.cfg 中的设置没有。)
  3. 然后尝试更改(刷新网页)。

有关 --multigraphs 的更多详细信息,请参阅 hobbitsvc.cgi 文档。(man hobbitsvc.cgi

我不想在我的显示中显示 foo 列。我该怎么做 ?

[编辑 | 编辑源代码]

A. 添加条目 NOCOLUMNS:foo,bar 来隐藏列 foo 和 bar。

如何检查以确保某些东西没有运行?

[编辑 | 编辑源代码]

A. 在 bb-hosts 中

1.2.3.4 my.host.com # !ftp 

这将导致测试在 FTP 运行时变红

我想监控 Windows 服务器。我该怎么做?

[编辑 | 编辑源代码]

如果必须,请使用 BBWin 作为您的客户端。 http://bbwin.sourceforge.net/

BBWin 的 XML 和中央模式之间的转换是什么?

[编辑 | 编辑源代码]

(注意: 未测试,但希望准确)

BBWin 近似值 hobbit-clients.cfg
<uptime>
  <setting name="delay" value="(bootlimit)" alarmcolor="yellow" />
  <setting name="maxdelay" value="(toolonglimit)" alarmcolor="yellow" />
</uptime>
UP bootlimit toolonglimit
<cpu>
  <setting name="default" warnlevel="(warnlevel)" paniclevel="(paniclevel)" />
</cpu>
LOAD warnlevel paniclevel
N/A CLOCK maximum-offset
<disk>
  <setting name="(drive)" warnlevel="(warn)" paniclevel="(panic)" />
  <setting name="(drive)" ignore="true" />
</disk>
DISK drive warn panic

DISK drive IGNORE

<memory>
  <setting name="physical" warnlevel="(warn)" paniclevel="(panic)" />
  <setting name="virtual" warnlevel="(warn)" paniclevel="(panic)" />
  <setting name="page" warnlevel="(warn)" paniclevel="(panic)" />
</memory>
MEMPHYS warn panic

MEMACT warn panic
MEMSWAP warn panic

<procs>
  <setting name="(processname)" rule="-=3" alarmcolor="(color)" comment="(text)" 
  <setting name="(processname)" rule="+=4" alarmcolor="(color)" comment="(text)" 
</procs>
PROC processname 0 3 color TEXT=text

PROC processname 4 -1 color TEXT=text

N/A FILE filename color
(参见 fsmon.cfg) DIR directory color SIZE<maxsize SIZE>minsize
<stats>
</stats>
PORT
<svcs>
  <setting name="(svcname)" value="(status") autoreset="(startup)" alarmcolor="(color)">
</svcs>
SVC svcname startup status color
<who>
</who>
N/A

(注意: 不完全准确,但好的起点)

BBWin client-local.cfg
<msgs>
  <match logfile="System">
  <ignore logfile="System" value="(text string)">
</msgs>
eventlog:System

ignore text string

我在 Windows 上遇到 bbwin 的问题......

[编辑 | 编辑源代码]

A. 请将 bbwin 问题发布到 bbwin 论坛

BBWIN 客户端运行良好。我已经重新使用了一个在 Big Brother 之前运行的脚本。结果保留在 C:\BBWin\logs 中。

所有其他内容都报告给服务器,但不是外部。

<?xml version="1.0" encoding="utf-8"?> <configuration>

 <bbwin>
   <setting name="bbdisplay" value="192.168.1.132" />
   <setting name="mode" value="local" />
   <setting name="configclass" value="win32" />
   <setting name="autoreload" value="true" />
   <setting name="timer" value="5m" />
   <load name="cpu" value="cpu.dll" />
   <load name="disk" value="disk.dll" />
   <load name="externals" value="externals.dll" />
   <load name="filesystem" value="filesystem.dll" />
   <load name="memory" value="memory.dll" />
   <load name="msgs" value="msgs.dll" />
   <load name="procs" value="procs.dll" />
   <load name="stats" value="stats.dll" />
   <load name="svcs" value="svcs.dll" />
   <load name="uptime" value="uptime.dll" />
   <load name="who" value="who.dll" />
   <setting name="loglevel" value="3" />
   <setting name="logpath" value="C:\BBWin\logs\BBWin.log" />
   <setting name="logreportfailure" value="false" />
   <setting name="hostname" value="vs3k-gap" />
 </bbwin>
 <cpu>
   <setting name="alwaysgreen" value="false" />
   <setting name="default" warnlevel="90" paniclevel="95" delay="3" />
 </cpu>
 <disk>
   <setting name="alwaysgreen" value="false" />
   <setting name="default" warnlevel="85%" paniclevel="95%" />
   <setting name="remote" value="false" />
   <setting name="cdrom" value="false" />
 </disk>
 <externals>
   <setting name="timer" value="1m" />
   <setting name="logstimer" value="60s" />
   <load value="C:\BBWin\ext\sqlv.cmd" timer="1m" />
 </externals>
 <memory>
   <setting name="alwaysgreen" value="false" />
   <setting name="physical" warnlevel="78" paniclevel="98" />
   <setting name="page" warnlevel="70" paniclevel="90" />
   <setting name="virtual" warnlevel="78" paniclevel="90" />
 </memory>
 <msgs>
   <setting name="alwaysgreen" value="false" />
   <setting name="delay" value="1h" />
   <match logfile="System" type="error" alarmcolor="red" />
   <match logfile="System" type="warning" alarmcolor="yellow" />
   <match logfile="Application" type="error" alarmcolor="red" />
   <match logfile="Application" type="warning" alarmcolor="yellow" />
   <match logfile="Security" type="fail" />
 </msgs>
 <procs>
 </procs>
 <svcs>
   <setting name="alwaysgreen" value="false" />
   <setting name="autoreset" value="false" />
   <setting name="alarmcolor" value="yellow" />
   <setting name="Windows Time" value="started" autoreset="true" alarmcolor="red" />
 </svcs>
 <uptime>
   <setting name="delay" value="30m" />
   <setting name="maxdelay" value="365d" />
 </uptime>

</configuration>

文件脚本生成输出

OK

echo green ***Error en Chequeo SQLV, Servidor:%computername% >> C:\BBWin\logs\sqlv echo ^&green ***Error en Chequeo SQLV, Servidor:%computername% >> C:\BBWin\logs\sqlv

BAD

echo red ***OK en Chequeo SQLV, Servidor:%computername% >> C:\BBWin\logs\sqlv echo ^&red ***OK en Chequeo SQLV, Servidor:%computername% >> C:\BBWin\logs\sqlv

我设置了我的客户端,但状态页面上没有显示任何内容?

[编辑 | 编辑源代码]

A. 检查幽灵客户端报告或 hobbitd 状态页面。它可能配置错误。

我们正在更改主机名称,并希望继续监控它,并保留历史记录。有办法吗?

[编辑 | 编辑源代码]

A. 检查帮助菜单 ~/server/bin/bb 127.0.0.1 "rename OLDHOSTNAME NEWHOSTNAME" 中的 Hobbit 提示和技巧页面

我不想使用 rrdtool 来创建数据平均值和循环数据,我想永远保留所有数据。我能做到吗?

[编辑 | 编辑源代码]

A. 当前快照中有一种方法可以做到这一点,包括一个新的 hobbitd_rrd 手册页,其中描述了如何运行它。

  and what the input to your custom script looks like. 
  The option is—processor=COMMAND 
  It will feed the raw data via stdio into COMMAND 
  COMMAND can then process the data into another storage system.

我的 AIX 系统上没有编译器。在哪里可以获取预编译的 Hobbit 客户端?

[编辑 | 编辑源代码]

A. http://www.docum.org/twiki/bin/view/Hobbit/HobbitClients

如何取消订阅 Hobbit 邮件列表?

[编辑 | 编辑源代码]

A. 如果您必须离开,请发送电子邮件至 [email protected]

如何将 hobbit 搜索引擎插件添加到 Internet Explorer 7 中?

[编辑 | 编辑源代码]

'A. 等待贡献。

如何将 hobbit 搜索引擎插件添加到 FireFox 2 中?

[编辑 | 编辑源代码]

A. 复制以下文件并将其保存为“c:\Program Files\Mozilla Firefox\searchplugins\hobbit.xml”(这是 OpenSearch 描述格式,与 FireFox 2 和 Internet Explorer 7 都兼容)。相应地调整您网站的 url 地址。

hobbit.xml

然后重新启动 Firefox。您应该会看到一个 hobbit 蓝色微笑图标显示在搜索栏中。参考

是否可以通过电子邮件禁用和确认警报,如何?

[编辑 | 编辑源代码]

包括一个IGNORE exception with hosts or alert that you wish to ignore

  HOST=* SERVICE=*
     IGNORE HOST=%[a-z]{3}[0-9]{4} 
     MAIL [email protected]

或者更具体一些

  HOST=* COLOR=red
     IGNORE HOST=marketing.foo.com SERVICE=cpu TIME=4:1500:1800
     MAIL [email protected]

并检查配置

  $ cd ~/server
  $ ./bin/bbcmd hobbitd_alert—test tic0102 comm
  00026606 2012-03-01 10:52:51 *** Match with 'IGNORE HOST=%[a-z]{3}[0-9]{4}' ***
  00026606 2012-03-01 10:52:51 IGNORE rule found

我是否可以为确认警报设置最大时间限制?

[编辑 | 编辑源代码]

A.

我是否可以限制在启用/禁用页面上可以禁用的主机?

[编辑 | 编辑源代码]

A.

我是否可以仅在一台显示服务器上启用/禁用,并在两台服务器上显示它?

[编辑 | 编辑源代码]

典型的双显示服务器安装会将它们配置为独立运行。每个 Xymon 显示服务器在XYMSERVERS设置中仅列出自身xymonserver.cfg,因此通常情况下,启用/禁用页面只适用于提供表单的服务器。

然而,XYMSERVERS值可以为每个 CGI 脚本覆盖,启用/禁用表单会向XYMSERVERS中定义的所有 Xymon 服务器发送更新。要覆盖启用/禁用,请执行以下操作。

创建文件xymonserver-enadis.cfg包含

 include /etc/xymon/xymonserver.cfg
 XYMSERVERS="display1 display2"  # replace with IP addresses of Xymon servers

然后编辑cgioptions.cfg并添加以下行

 XYMONENV_ENADIS=/usr/lib/xymon/server/etc/xymonserver-enadis.cfg

并修改CGI_ENADIS_OPTS以引用新变量

 CGI_ENADIS_OPTS="--env=$XYMONENV_ENADIS"

短信警报格式是否可以重新配置以显示更多或更少的信息?

[编辑 | 编辑源代码]

A. 不能直接配置,但已编写了一个警报脚本(smsplus)以提供比默认短信输出更多的信息。可以使用以下环境变量(来自 hobbit 文档)轻松修改脚本。

名称 描述
BBCOLORLEVEL 状态的当前颜色
BBALPHAMSG 触发警报的状态日志的完整文本
ACKCODE 可用于确认警报的“cookie”
RCPT 收件人,来自 SCRIPT 条目
BBHOSTNAME 警报所涉及的主机名称
MACHIP 出现问题的机器的 IP 地址
BBSVCNAME 警报所涉及的服务名称
BBSVCNUM 服务的数字代码。来自 SVCCODES 定义。
BBHOSTSVC 警报所涉及的 HOSTNAME.SERVICE。
BBHOSTSVCCOMMAS 与 BBHOSTSVC 相同,但主机名中的点被替换为逗号
BBNUMERIC 由 BBSVCNUM、MACHIP 和 ACKCODE 构成的 22 位数字。
RECOVERED 如果服务已恢复,则为“1”。
DOWNSECS 服务已停止运行的秒数。
DOWNSECSMSG 恢复时,保存文本“事件持续时间:N”,其中 N 是 DOWNSECS 值。

Q. 如何使用 Hobbit Server 启用 SNMP 监控?

[编辑 | 编辑源代码]

A 1. http://cerebro.victoriacollege.edu/hobbit-trap.html

A 2. http://devmon.sourceforge.net

Q. 如何配置多个黄色到红色的警报?

[编辑 | 编辑源代码]
On Wed, Apr 18, 2007 at 04:11:13PM -0400, Galen Johnson wrote:

> I'll admit I haven't put a lot of legwork into this but...is it 
> possible to configure hobbit to go red on a test after a certain 
> number of cycles at yellow?  I have some tests that I don't mind 
> if they are yellow for small period but if they are there too long 
> I need to know.

A. 在 bb-hosts 中使用“badTEST”设置(请参阅手册页)。这会延迟黄色或红色状态出现,直到它保持黄色(或红色)几个测试周期。因此,您可以使用它来抑制黄色状态,直到它保持黄色一段时间,这样当它确实变为黄色时,您就知道需要处理它。

或者,如果您的自定义测试报告了“红色”状态,您可以让它在前 5 个测试周期内保持黄色,之后变为红色。

Henrik

注意:目前,它只适用于 ping 测试。

Q. 如何将 hobbit 客户端与 BB 服务器一起使用?

[编辑 | 编辑源代码]

A.

On Wed, Sep 06, 2006 at 01:48:02PM -0500, Rich Smrcina wrote:
> Is the new Hobbit client compatible with the old BigBrother server?
> BigBrother is run by a different part of the organization and I may not 
> be able to get them to change to Hobbit, but for my Linux guests and my 
> z/VM systems, I would be interested in converting to the new Hobbit code.

In the default mode, you cannot use the Hobbit client to report to a Big
Brother system. No data would ever show up, because a Big Brother server
doesn't know how to feed the client data through the hobbitd_client
module, which takes care of converting the client data into status
columns.

However, you *can* run the Hobbit client in the local-configuration
mode. When the configure script asks
   Server side client configuration, or client side [server] ?
answer "client", and the launch the client with the "--local" option.

In this mode, the client sends normal "status" messages to the Hobbit/BB
server. I'm not sure if alerts will work, though, since the Hobbit
client doesn't generate the "page" messages that the BB server expects
to trigger sending out alerts. (Hobbit ignores these messages
completely, so it did seem like a waste of time to generate them).

Note that this isn't really described very well anywhere. It means you
will have to maintain the client configuration on the client, not on the
Hobbit server.

Regards,
Henrik

Q. 如何在 Solaris 10 中以非 root 用户身份启用 fping?

[编辑 | 编辑源代码]
The problem
bash-3.00$ more bb-network.log
2006-08-29 17:31:02 Execution of 'hobbitping -Ae' failed - program not suid root?
2006-08-29 17:31:02 2006-08-29 17:31:02 Cannot get RAW socket: Permission denied
bash-3.00$
the fix
There are 3 files that need to be updated so that fping can be executed as root (uid=0)
on Solaris by a named user, in this case the hobbit user.

The three files in question are,
/etc/user_attr
/etc/security/exec_attr
/etc/security/prof_attr

These have been updated with the following lines

In /etc/user_attr:
hobbit::::profiles=Hobbit Commands

In /etc/security/exec_attr:
Hobbit Commands:solaris:cmd:::/usr/local/hobbit/server/bin/hobbitping:uid=0

In /etc/security/prof_attr:
Hobbit Commands:::Hobbit Commands:

Regards,

Mike Rowell, edited by T.J. Yang
References: http://docs.sun.com/app/docs/doc/816-4557/6maosrjfc?a=view

Q. 您是否可以使用 hobbit 服务器,但保留您的 bb 客户端?

[编辑 | 编辑源代码]

A. 可以。Hobbit 100% 兼容 BB 客户端。但要注意,bb 1.9c 之后,许可证变得更加严格,您需要为每个座位付费。

Q. Big Sister 是什么?

[编辑 | 编辑源代码]

Q. 是否有关于系统监控工具的简要概述?

[编辑 | 编辑源代码]

Q. 监控系统应该具备哪些功能?

[编辑 | 编辑源代码]

Q. 从 BB 迁移到 Hobbit 安全吗?

[编辑 | 编辑源代码]
-----Original Message-----
From: Henrik Stoerner [mailto:[email protected]] 
Sent: Tuesday, August 01, 2006 5:13 PM
To: [email protected]
Subject: Re: [hobbit] Hobbit newbie from BB: differences and what may I
lose from migrating?

Hi Jordan,

I'll try to answer your questions. Since I also develop Hobbit I am
probably slightly biased when it comes to the "is-this-more-difficult-
to-do-than-with-BB" type of questions, but I am sure others will
voice their opinions on that.

On Tue, Aug 01, 2006 at 12:36:29PM -0700, Jordan Mendler wrote:
> 
> First, after reading through whatever I could find on the website I am
> still a little bit confused about configuration and setup. With BB,
> you install and configure each client and server on the local machine,
> except for the universal bb-hosts. Is this the same on Hobbit, or does
> Hobbit use a central configuration file that is modified only on the
> server to configure clients? I am trying to figure out the difference
> between installing, maintaining and configuring BB and Hobbit setups.

First, let me stress that Hobbit is fully compatible with your existing
BB clients. You can keep your current client setup and just switch to
Hobbit on the server side, and all of your clients will continue to 
work as they do with BB as the server. So you can migrate the server
side first, and then migrate clients when you find that it is convenient
to do so - or you want to take advantage of some of the new stuff that
is in Hobbit.

The Hobbit client configuration is maintained on the Hobbit server. 
Clients in Hobbit are designed to be *really* dumb; they just collect
data, and all of the configuration of what to monitor, what thresholds
to use for e.g. disk utilization and so on is configured only on the
Hobbit server.

This is a major difference between Hobbit and BB. With BB you have
delegated the client administration to whoever manages each server.
Hobbit centralizes the monitoring configuration, so you will probably
have a group of people who take more control of the monitoring setup.

> Hobbit looks a lot more complex to setup, but once I get my feet wet is
> it any harder than BB?

I think it is easier, once you get used to the Hobbit way of doing
things. But as I said, I am biased.

> Second is performance. I know this list may be biased toward Hobbit,
> but is it actually faster? We have about 50-100 clients on BB and I did
> not notice any performance issues.

With that number of systems monitored, you probably will not see a huge
difference. BB works quite well for a small number of systems, but when
you move beyond a couple of hundred boxes the overhead of generating 
webpages through shell scripts becomes very noticeable. On my setup,
the servers were simply choking on the disk I/O caused by BB saving
every status in a separate file, and from the huge number of small
cut-grep-awk-sed etc. commands that ran to generate webpages.

> Hobbit looks like it is very complex, so does this mean it uses a lot 
> of resources on the client and server? What speed/ram server is
> usually the minimum recommended for a dedicated Hobbit server? Would
> something like a dual Pentium II 266mhz have any performance issues 
> as a server, if it does nothing else? What about for clients? We have
> still have some testing, stating and production servers left that are
> singe chip Pentium III 700-850 mhz, and even a couple Pentium II's. 
> Just need to make sure all the resources used for things like graphs
> are taken from the server and not each client.

The Hobbit server uses fewer resources than the BB server. The main
resource usage is memory; Hobbit keeps everything in memory except 
the history logs and the RRD files used for graphs. That doesn't mean
a whole lot, though: Here's a ps listing of the Hobbit processes running

on my main monitoring system - it handles about 2500 hosts:

$ ps vax|cut -c1-100|egrep "PID|hobbit"
  PID TTY      STAT   TIME  MAJFL   TRS   DRS  RSS %MEM COMMAND
  732 ?        Ss     1:24      0   101  1802  696  0.0 hobbitlaunch
  735 ?        S    2434:37     1   162 31357 29784  2.8 hobbitd
 1470 ?        S     14:50      0    99  2332 1088  0.1 hobbitd_channel --channel=stachg
 1471 ?        S     25:18      0   108  2515 1048  0.1 hobbitd_history
 1472 ?        S    964:26      0    99  2332 1264  0.1 hobbitd_channel --channel=page
 1473 ?        S    1227:34     0   154  5661 3912  0.3 hobbitd_alert
 1474 ?        S    4090:05     0    99  2332 1264  0.1 hobbitd_channel --channel=status
 1475 ?        D    2962:15     0   178  7381 4392  0.4 hobbitd_rrd
 1476 ?        S    259:55      0    99  2332 1208  0.1 hobbitd_channel --channel=data
 1477 ?        S    494:13      0   178  5141 2128  0.2 hobbitd_rrd
 1478 ?        S    126:20      0    99  2844 1832  0.1 hobbitd_channel --channel=client
 1480 ?        S    291:20      0   146  4485 2792  0.2 hobbitd_client
 5552 ?        S      0:00      0   669  2002 1352  0.1 sh -c vmstat 300 2 1>/usr/lib/hobbit/client/

As you can see, the biggest chunk of memory goes to the "hobbitd"
process which is the one that keeps all state information. It's
currently using some 31 MB of memory. (This box has 1 GB RAM).

A rough estimate of how much memory Hobbit needs would be the size of
your bbvar/logs/ directory, plus 30 MB.

As for CPU usage, your PII/266 should be adequate for 50-100 servers.
The box I'm running on is an old (7-8 years) Solaris server with a 
900 MHz UltraSparc II processor. That's roughly comparable to a PII
running at 1.2 GHz. And it handles 25 times as many hosts as you are
aiming for.

> Third is plugins. Are BB plugins compatible with Hobbit?

Yes.

> Also how hard are plugins to write for Hobbit?

Plugins that run on the monitored client systems are as easy to write
as for BB, since it is basically the same thing.

Hobbit also allows you to write plugins for the Hobbit server, which
receive events from the Hobbit server daemon. This is used by the 
core Hobbit tools - e.g. the hobbitd_rrd processes you see in the
ps-listing above are a plugin that handle updating of the RRD files
from the status- and data-messages that are sent to Hobbit. There
aren't any third-party plugins that use this yet (at least, I 
don't know of any), but writing them is fairly simple since it 
basically involves reading data from a pipe and processing it in
whatever way you want.

> I don't know if these even exist for bb, but I ultimately would 
> like to integrate plugins that 1) monitor legato tape backup,

Don't know about this.

> 2) run nmap to see what ports are open/can be seen from an external 
> machine,

The Hobbit client in version 4.2 (about to be released soon) reports
details about the network services running on a host. So you can check
for which ports are open/listening for connections, and trigger alerts
if any unwanted ports show up.

> 3) run 'lshw -html' to show a list of all the hardware on the system,

This would typically be a client-side test.

> 4) monitor uptime,

This is standard.

> 5) monitor OS and kernel versions (uname -a and head -n 1 /etc/issue),

This data is collected by the Hobbit client.

> 6) maybe some more router/network monitoring stuff and

Hobbit comes with built-in network service monitoring. There is also
an SNMP add-on which can be used for monitoring devices such as routers.

> Fourth is relay. By this I mean monitoring systems on a private
> subnetwork that are only accessible to the Hobbit server by going
> through an intermediate server. Is this possible with Hobbit and is it
> any more difficult to do than on BB?

Two ways of doing that. First, there is a proxy utility which is used
to forward Hobbit messages from one network to another. This is used if
your client systems on the private subnet are allowed to make outgoing
connections to the proxy, and the proxy can connect to the real Hobbit
server.

Second, Hobbit 4.2 includes a set of tools where it's the server that
contacts clients to pick up the data they have collected (i.e. the
traffic is initiated by the server, where the normal BB setup is for 
the client to initiate the connection). Useful for DMZ style setups
where clients are not allowed to generate outbound connections.

> Fifth is portability. BB is very portable, I can make a 'model' client
> for say Red Hat and tar it and distribute it very easily to every
> server I have using only a few commands. Is Hobbit the same, or are there
> client dependencies or other things that may make this more difficult.

The Hobbit client uses only the system libraries and standard utilities 
found on your client systems. You will need at least one system where
you can compile the client binaries (that's similar to the BB
requirements), since a few of the client-side tools are written in C.

Once you have a client compiled for an OS, it is as portable as any
binary that is dynamically linked on your platform. I.e. you can 
just copy it over as long as the same run-time libraries are available.

So far, we haven't managed to find any unix-like system that couldn't
run the Hobbit client. Including some rather odd ones. The current list
of client-side data collectors are

hobbitclient-aix.sh    hobbitclient-darwin.sh  hobbitclient-freebsd.sh
hobbitclient-hp-ux.sh  hobbitclient-irix.sh    hobbitclient-linux.sh
hobbitclient-netbsd.sh hobbitclient-openbsd.sh hobbitclient-osf1.sh
hobbitclient-sunos.sh

> Sixth is development. How active is the development of Hobbit, how big
> is the community, etc? How many people can attest to having fully
> functional hobbit setups, how long has it been around and how often
> are new releases usually made?

Hobbit started back in late 2002 when it was called the "bbgen toolkit".
It was renamed to Hobbit in March 2005 when it had developed into a 
complete replacement for BB. More details in the hobbit(7) man-page
available online at http://www.hswn.dk/hobbit/help/manpages/

It is actively being developed by me, but people on this list have
made contributions of code. Some have picked up special projects
like the Windows client and run that completely on their own.
I'd say Hobbit currently has a very active user community, and
the development community is slowly growing beyond just myself.

There are currently 433 subscribers to the Hobbit mailing list.
According to the Sourceforge download statistics, it is downloaded
about 1000 times per month.
http://sourceforge.net/project/stats/?group_id=128058&ugn=hobbitmon&type
=&mode=year

There was a thread on the mailing list back in May about who uses
Hobbit. The results were summarized here:
https://wikibooks.cn/wiki/System_Monitoring_with_Hobbit/User_Guide#Wh
o_use_Hobbit_.3F

New releases have usually happened frequently - 2-4 times a year.
The current interval between the 4.1.2 release and version 4.2 is 
unusually long - a whole year. I don't expect that to happen again.

> Also I saw something this morning about a Windows client -- how 
> stable is that?

From what I hear it should be usable. But you can stick with the
current BBNT client until it reaches version 1.0.

> How stable is the Solaris version?

Rock-solid.

> Is there a client for Mac OSX?

Yes. It will run the Hobbit server also, if you want to.

> Is Hobbit like BB in the sense that you can change paths to system 
> binaries like grep and sed to allow easy use on other UNIXes like OSX?

Adding a client for a new OS will require implementing both a
client-side script to collect whatever data is interesting for this
system, and implementing the data parsing on the Hobbit server-side.
So it is somewhat more challenging. But since Hobbit already supports
all of the common Unix systems, I doubt that you will need to worry 
about that. If you do have a system which is not on the list, I will
help you with adding support for it.

> When will 4.2 be officially released as a production version?

Probably by the end of this week.

> Since we have a working BB setup for now, I need to
> decide if I should try to start migrating now or if I should wait some
> time for Hobbit to develop more before I migrate from BB.

I don't think you have to wait. But it's for You to decide.

Regards,
Henrik

Q. NOCOLUMNS 是否必须引用客户端行,还是可以引用 bb-hosts 中的页面/子页面?

[编辑 | 编辑源代码]

A. 等待贡献。

Solaris 开发人员常见问题解答

[编辑 | 编辑源代码]

Q. 64 位 hobbit 服务器与 32 位服务器相比有什么优势?

[编辑 | 编辑源代码]

Q. 如何启用 64 位编译?

[编辑 | 编辑源代码]
  CC=cc CFLAGS="-mr -Qn -xstrconst -xO2 -xtarget=ultra2 -xarch=v8plusa" 
  CC_LD_RT="-R"

Meaning of each option:
-mr:
-Qn:
-xstrconst: 
-xO2
-xtarget=ultra2
-xarch=v8plusa
  CC=cc CFLAGS="-mr -Qn -xstrconst -xO2 -xtarget=general -xarch=v9" 
  CC_LD_RT="-R" 

问:32 位 hobbit 服务器的示例

[编辑 | 编辑源代码]
bash-3.00# file hobbitd
hobbitd:        ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, 
                UltraSPARC1 Extensions Required, dynamically linked, not stripped
bash-3.00#

来自 Sun 编译器的警告信息

[编辑 | 编辑源代码]

以下是使用 Sun 编译器产生的警告信息。

问: "指向无符号字符的指针" = "指向字符的指针"

[编辑 | 编辑源代码]
  • 错误信息。
bash-3.00# gmake
cc -mr -Qn -xstrconst -xO2 -xtarget=ultra2 -xarch=v8plusa -D_REENTRANT  -DSunOS -o safequery\
 safequery.c
"safequery.c", line 12: warning: assignment type mismatch:
        pointer to unsigned char "=" pointer to char
bash-3.00#

  • 源代码
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

char *safechars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_+?~=";

int main(int argc, char *argv[])
{
    unsigned char *querystring;
    unsigned char *p;

    querystring = getenv("QUERY_STRING");
    if (!querystring) {
       return 0;
    };

    for (p=querystring; (*p); p++) {
      if (!strchr(safechars, *p)) {
         return 1;
      }
    }
  • 注意:getenv() 的文档说明其返回char *,而不是unsigned char *.


"loadhosts.c", line 463: warning: statement not reached
         prototype: pointer to char : "/opt/build/hobbit-4.2.0/include/../lib/strfunc.h", line 16
         argument : pointer to unsigned char
"loadhosts.c", line 463: warning: statement not reached
"loadhosts.c", line 521: warning: return value type mismatch
"hobbitd_alert.c", line 543: warning: assignment type mismatch:
        pointer to char "=" pointer to unsigned char
"hobbitd_alert.c", line 665: warning: assignment type mismatch:
        pointer to unsigned char "=" pointer to char
"hobbitd_alert.c", line 692: warning: argument #1 is incompatible with prototype:
         prototype: pointer to unsigned char : "/opt/build/hobbit-4.2.0/include/../lib/encoding.h",
         line 17
         argument : pointer to char
"hobbitd_alert.c", line 701: warning: assignment type mismatch:
         pointer to unsigned char "=" pointer to char
"hobbitd_alert.c", line 719: warning: assignment type mismatch:
         pointer to unsigned char "=" pointer to char
"do_alert.c", line 182: warning: argument #2 is incompatible with prototype:
       prototype: pointer to char : "/opt/build/hobbit-4.2.0/include/../lib/strfunc.h", line 16
       argument : pointer to unsigned char
"do_alert.c", line 190: warning: argument #1 is incompatible with prototype:
       prototype: pointer to char : "/opt/build/hobbit-4.2.0/include/../lib/misc.h", line 25
       argument : pointer to unsigned char
"do_alert.c", line 253: warning: argument #1 is incompatible with prototype:
       prototype: pointer to char : "/opt/build/hobbit-4.2.0/include/../lib/misc.h", line 25
       argument : pointer to unsigned char
"do_alert.c", line 272: warning: argument #1 is incompatible with prototype:
       prototype: pointer to char : "/opt/build/hobbit-4.2.0/include/../lib/misc.h", line 25
       argument : pointer to unsigned char

管理常见问题解答

[编辑 | 编辑源代码]

如何监控 HP-UX 网络日志?

[编辑 | 编辑源代码]
On Mon, Jan 28, 2008 at 12:06:22PM -0500, Robert Herron wrote:
> HP-UX stores its network log in a binary file (/var/adm/nettl.LOG000) that
> you view with the netfmt command.  Before I start working on my own, does
> anyone have an EXT script to monitor it?  If so, could I have a copy?

Alternatively, you could modify the HP-UX client script to generate a
normal Hobbit "msgs" section with the text-output from the netfmt
command; then Hobbit can process it as if it were an ordinary text-based
logfile.

E.g. at the bottom of the hobbitclient-hp-ux.sh script running on your
clients, just before the "exit" command add this:

   echo "[msgs:/var/adm/nettl.LOG000]"
   netfmt ...whatever needs to go here to get the text-output ...

Then you can use a normal log-file entry on the Hobbit server to process
the log data.

Regards,
Henrik

问:如何在 hobbit 服务器上启用 RSS?

[编辑 | 编辑源代码]

A.

  • 在 hobbitserver.cfg 文件中,将 BBGENOPTS 变量从以下
BBGENOPTS="--recentgifs --subpagecolumns=2"     # Standard options for bbgen.
  • 更改为以下
# enable RSS by " --rss --rsslimit=yellow"
BBGENOPTS="--recentgifs --subpagecolumns=2  --rss --rsslimit=yellow"     # Standard options for bbgen.
  • www 目录中新创建的 RSS 文件应该类似于以下
bash-3.00$ ls -lrt /opt/moto/hobbitserver42/www/*.rss
-rw-r--r--   1 hobbits  hobbits      714 Jan 22 07:50 /opt/moto/hobbitserver42/www/bb.rss
-rw-r--r--   1 hobbits  hobbits     6184 Jan 22 07:50 /opt/moto/hobbitserver42/www/bb2.rss
-rw-r--r--   1 hobbits  hobbits      337 Jan 22 07:50 /opt/moto/hobbitserver42/www/bbnk.rss
bash-3.00$

问:如何在 Solaris 10 上为 hobbit 配置 SMF?

[编辑 | 编辑源代码]

答:来自:Everett, Vernon [1] 对于那些熟悉 Solaris 10 的人来说,你应该了解服务,但对于某些人来说,添加新服务有点棘手。为了让 Hobbit 作为服务运行,我们需要执行以下操作。

创建一个名为 /var/svc/manifest/application/hobbit.xml 的文件,内容如下

<?xml version="1.0"?>

<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

<!--
Copyright 2007 Vernon Everett - vernon(a)everett.co.za
Free for use and distibution for non-commercial purposes.
No warranty exists either implicit or implied.
Standard disclaimer applies.
Commercial use is subject to license terms.
-->

<service_bundle type='manifest'name='Hobbit-monitor:hobbit'>

<service name='application/hobbit' type='service' version='1'>
<dependency name='filesystem' grouping='require_all' restart_on='none' type='service'>

<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<dependency name='multi-user-server' grouping='optional_all' type='service' restart_on='none'>
<service_fmri value='svc:/milestone/multi-user-server' />
</dependency>
        <exec_method type='method' name='start'exec='/usr/lib/hobbit/client/runclient.sh start'
         timeout_seconds='10'>
<method_context>
<method_credential user='hobbit'/>
</method_context>
</exec_method>
        <exec_method type='method' name='stop' exec='/usr/lib/hobbit/client/runclient.sh stop'
         timeout_seconds='10'>
<method_context>
<method_credential user='hobbit' />
</method_context>
</exec_method>
<exec_method type='method' name='restart' exec='/usr/lib/hobbit/client/runclient.sh restart'
 timeout_seconds='10'  >
<method_context>
<method_credential user='hobbit' />
</method_context>
</exec_method>
        <instance name='default' enabled='true' />
        <stability value='Unstable' />
        <template>
<common_name>
<loctext xml:lang='C'> Hobbit Monitor Client </loctext>

</common_name>

</template>

</service>

</service_bundle>

注意第 37、47 和 57 行,这些行以 "exec=" 开头。你可能需要编辑 Hobbit 启动脚本的路径。

为了避免混淆或可能出现的问题,此时请使用 runclient 脚本关闭 hobbit 客户端。

现在,以 root 身份运行以下命令

#svccfg import /var/svc/manifest/application/hobbit.xml

我们现在应该有一个名为 hobbit 的服务。

#svcs | grep hobbit
online 9:23:05 svc:/application/hobbit:default

(它可能此时已上线)

你现在可以像对待普通服务一样对待它。如果它还没有上线,请像往常一样启动它。

#svcadm enable hobbit

可能需要先禁用它,然后再启用它,但这样应该可以启动它。

并且因为我们已将默认设置设为启用,所以服务应该在你重启时自动启动。

通过执行以下操作来确认一切正常

# ps -efa | grep hobbit

所有通常的脚本都应该在运行。

如果你不再希望它作为服务运行,以 root 身份运行以下命令

#svccfg delete hobbit.

这将删除服务,并允许你继续从 runclient 脚本运行它。

问:如何使用 SMF 为 Solaris 10 配置 Hobbit 客户端?

[编辑 | 编辑源代码]

答:复制自 http://xymonton.org/addons:hobbitsmf

 These are service manifest files for Solaris 10. These will allow you to import the hobbit start
 and stop scripts for the server/client into the new Solaris Service Management Facility (Solaris 10
 replacement of /etc/rcN.d).

Installation

   1. mkdir -p /var/svc/manifest/application/monitoring/hobbit
   2. copy the client and server xml files to /var/svc/manifest/application/monitoring/hobbit
   3. import the service(s)

      svccfg import /var/svc/manifest/application/monitoring/hobbit/server.xml
      svccfg import /var/svc/manifest/application/monitoring/hobbit/client.xml

   4. enable the service(s)

      svcadm enable svc:/application/monitoring/hobbit/client:default
      svcadm enable svc:/application/monitoring/hobbit/server:default

Source
Hobbit Client

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
    client.xml : Hobbit Client manifest, Galen Johnson
    2007-04-13
    based on bigbrother.xml : BigBrother manifest, Kyle Reynolds
    2006-07-02
-->
 
<!--
    Solaris 10 SMF manifest file for Hobbit client. Just place in
    /var/svc/manifest/application/monitoring/hobbit
    and run:
    'svccfg import /var/svc/manifest/application/monitoring/hobbit/client.xml'
    'svcadm enable svc:/application/monitoring/hobbit/client:default'
-->
 
<!--
    Be sure to change the path to runclient.sh to match your setup...
    Be sure to change the user and group hobbit runs as for your setup...
    If you need to provide the hobbit service additional group privs, add 
    them to the supp_groups in the method context.
-->
 
<service_bundle type="manifest" name="hobbit:client">
 
<service
    name="application/monitoring/hobbit/client"
    type="service"
    version="1">
 
    <create_default_instance enabled='false' />
 
    <single_instance />
    
    <dependency
        name="filesystem"
        grouping="require_all"
        restart_on="none"
        type="service">
        <service_fmri value="svc:/system/filesystem/local"/>
    </dependency>
 
    <dependency
        name="network"
        grouping="require_all"
        restart_on="none"
        type="service">
        <service_fmri value="svc:/network/initial"/>
    </dependency>
 
    <dependency
        name="multi-user-server"
        grouping="require_any"
        restart_on="error"
        type="service">
       <service_fmri value="svc:/milestone/multi-user-server:default"/>
    </dependency>
 
    <exec_method
        type="method"
        name="start"
        exec="/usr/local/hobbit/client/runclient.sh start"
        timeout_seconds="30">
        <method_context>
            <method_credential user="hobbit" group="bb"
                   supp_groups="" />
        </method_context>
    </exec_method>
 
    <exec_method
        type="method"
        name="stop"
        exec="/usr/local/hobbit/client/runclient.sh stop"
        timeout_seconds="30">
        <method_context>
            <method_credential user="hobbit" group="bb"
                  supp_groups="" />
        </method_context>
    </exec_method>
 
     <property_group name='startd' type='framework'>
        <!-- sub-process core dumps shouldn't restart session -->
        <propval name='ignore_error' type='astring' value='core,signal' />
    </property_group>
 
   <stability value="Unstable"/>
 
    <template>
        <common_name>
            <loctext xml:lang="C">
                Hobbit Client
            </loctext>
        </common_name>
        <documentation>
             <doc_link name='hobbit_monitor_site'
                uri='http://hobbitmon.sourceforge.net/' />
        </documentation>
    </template>
 
</service>
 
</service_bundle>

问:如何使用 SMF 为 Solaris 10 配置 Hobbit 服务器?

[编辑 | 编辑源代码]

答:复制自 http://xymonton.org/addons:hobbitsmf

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
    client.xml : Hobbit Server manifest, Galen Johnson
    2007-04-13
    based on bigbrother.xml : BigBrother manifest, Kyle Reynolds
    2006-07-02
-->
 
<!--
    Solaris 10 SMF manifest file for Hobbit server. Just place in
    /var/svc/manifest/application/monitoring/hobbit
    and run:
    'svccfg import /var/svc/manifest/application/monitoring/hobbit/server.xml'
    'svcadm enable svc:/application/monitoring/hobbit/server:default'
-->
 
<!--
    Be sure to change the path to hobbit.sh to match your setup...
    Be sure to change the user and group hobbit runs as for your setup...
-->
 
<service_bundle type="manifest" name="hobbit:server">
 
<service
    name="application/monitoring/hobbit/server"
    type="service"
    version="1">
 
    <create_default_instance enabled='false' />
 
    <single_instance />
 
    <dependency
        name="filesystem"
        grouping="require_all"
        restart_on="none"
        type="service">
        <service_fmri value="svc:/system/filesystem/local"/>
    </dependency>
 
    <dependency
        name="network"
        grouping="require_all"
        restart_on="none"
        type="service">
        <service_fmri value="svc:/network/initial"/>
    </dependency>
 
    <dependency
        name="multi-user-server"
        grouping="require_any"
        restart_on="error"
        type="service">
       <service_fmri value="svc:/milestone/multi-user-server:default"/>
    </dependency>
 
    <exec_method
        type="method"
        name="start"
        exec="/usr/local/hobbit/server/hobbit.sh start"
        timeout_seconds="30">
        <method_context>
            <method_credential user="hobbit" group="bb"/>
        </method_context>
    </exec_method>
 
    <exec_method
        type="method"
        name="stop"
        exec="/usr/local/hobbit/server/hobbit.sh stop"
        timeout_seconds="30">
        <method_context>
            <method_credential user="hobbit" group="bb"/>
        </method_context>
    </exec_method>
 
    <property_group name='startd' type='framework'>
        <!-- sub-process core dumps shouldn't restart session -->
        <propval name='ignore_error' type='astring' value='core,signal' />
    </property_group>
 
   <stability value="Unstable"/>
 
    <template>
        <common_name>
            <loctext xml:lang="C">
                Hobbit Server
            </loctext>
        </common_name>
        <documentation>
             <doc_link name='hobbit_monitor_site'
                uri='http://hobbitmon.sourceforge.net/' />
            <manpage title="hobbit" section="1" manpath="/usr/local/man"/>
        </documentation>
    </template>
 
</service>
 
</service_bundle>

问:如何在 hobbit 服务器上启用 devmon?

[编辑 | 编辑源代码]

答:http://www.techagent.com/devmon_snmp_hobbit_setup.htm 提供了一些在 hobbit 上启用 devmon 的步骤。

问:如何删除测试?

[编辑 | 编辑源代码]

A.

On Tue, Sep 05, 2006 at 08:07:34AM +0200, Ulric Eriksson wrote:
> I have figured out how to remove a single test from one host, or 
> all tests from a single host.

The command,   bb 127.0.0.1 "hobbitdboard"
is your friend, combined with a bit of scripting. E.g:

> Is it possible to remove a single test from *all* hosts?

bb 127.0.0.1 "hobbitdboard test=MYTEST fields=hostname" |
   while read H; do bb 127.0.0.1 "drop $H MYTEST"; done

> Or all tests from all hosts?

bb 127.0.0.1 "hobbitdboard test=info fields=hostname" |
   while read H; do bb 127.0.0.1 "drop $H"; done

> Or all tests that are purple?

bb 127.0.0.1 "hobbitdboard color=purple fields=hostname,testname" |
while read L; do 
      HOST=`echo $L | cut -d'|' -f1`
      TEST=`echo $L | cut -d'|' -f2`
      bb 127.0.0.1 "drop $HOST $TEST"
done

问:如何请求 hobbit 服务器要求 hobbit 客户端根据警报在本地运行命令?

[编辑 | 编辑源代码]

A.

Run this as a client extension:

  #!/bin/sh

  # Get the current status of the "msgs" column
  MSGSSTATUS=`$BB $BBDISP "query $MACHINE.msgs" | awk '{ print $1 }`

  # Get the command we must run from the client config
  CMD=`grep "^msgsrecovercmd:" $BBTMP/logfetch.$MACHINEDOTS.cfg | sed -e 's!^msgsrecovercmd:!!'`

  # If "msgs" is red and there is a command, run it
  if test "$MSGSSTATUS" = "red" -a "$CMD" != ""
  then
     $CMD
  fi

  exit 0

Before doing this, consider the security implications of having your
servers run commands that they fetch from a remote host without
authentication.

Regards,
Henrik

问:如何配置 "GROUP" 警报?

[编辑 | 编辑源代码]

答:"GROUP" 关键字用于 hobbit 中将许多进程名称或磁盘分区名称分类到不同的组中。此功能在大型 IT 环境中是必需的,通常不同的团队负责 IT 基础设施的不同区域。例如,一个 IT 组织通常包括网络、数据/存储、备份、数据库、应用程序和 Unix 团队。

  • hobbit-client.cfg:我们需要指定哪个进程将向哪个 GROUP 发送警报。
  • hobbit-alerts.cfg:在此文件中,我们随后指定哪个电子邮件地址接收 GROUP 警报。

这是用于学习目的的简单设置。假设当 / 使用率超过 93% 时,我们希望 Unix 团队收到通知。当 /boot 使用率超过 15% 时,应用程序团队需要收到通知。此外,当 cron 进程停止时,Unix 团队应该收到通知。当 Xvnc 超过 120 个进程时,应用程序团队也需要收到通知。

hobbit-client.cfg

[编辑 | 编辑源代码]
HOST=t-rh9.mywork.com
        DISK / 93 98            GROUP=UNIX_TEAM_PARTITION
        DISK /boot 15 20        GROUP=APPS_TEAM_PARTITION
        PROC cron 1 -1 yellow   GROUP=UNIX_TEAM_PROCESS
        PROC Xvnc 1 120 yellow  GROUP=APPS_TEAM_PROCESS
        PROC defunct  0 0  red
        LOG /var/log/messages  WARNING COLOR=yellow
        LOG /var/log/maillog   WARNING COLOR=yellow
        LOG /var/opt/hobbitclient42/log/clientlaunch.log WARNING COLOR=yellow
        LOG /var/opt/hobbitclient42/log/hobbitclient.log  WARNING
        FILE /etc/passwd  SIZE>0  OWNERID=root  COLOR=yellow

hobbit-alerts.cfg

[编辑 | 编辑源代码]

GROUP 后面的名称必须与 hobbit-client.cfg 中使用的名称完全相同。

GROUP=UNIX_TEAM_PROCESS
     MAIL [email protected] FORMAT=TEXT

GROUP=UNIX_TEAM_PARTITION
     MAIL [email protected] FORMAT=TEXT

GROUP=APPS_TEAM_PROCESS
     MAIL [email protected] FORMAT=TEXT

GROUP=APPS_TEAM_PARTITION
     MAIL [email protected] FORMAT=TEXT

Hobbit 提供了一个非常强大的调试工具来跟踪警报规则。从以下示例中,我们可以检查主机是否符合 hobbit-alert.cfg 中的所有规则。

  • 如何调试 "Oversize data/client msg" 错误信息?
    • 以下是一个示例错误信息
Oversize data/client msg from 10.5.64.212 truncated (n=2068326, limit 1961984)
First line: linux2.test.com|linux|linux
    • 检查从 hobbit 客户端发送的 msg 文件的大小。
# ls -l msg.linux2.test.com.txt
-rw-r--r--  1 hobbitc hobbitc 2068297 Jan 29 07:54 msg.linux2.test.com.txt
#
    • 找出为什么 msg.linux2.test.com.text 如此之大。
  • 通过运行 bbcmd 设置调试环境。它将设置所有 hobbit 环境变量。
bash-3.00$ bin/bbcmd
2007-07-23 14:28:21 Using default environment file /etc/opt/hobbitserver42/hobbitserver.cfg
bash-3.00$
  • 同时查看 hobbitd_alert 的命令语法。
$ bin/hobbitd_alert --debug --test
Usage: hobbitd_alert --test HOST SERVICE [options]
Possible options:
        [--duration=SECONDS]
        [--color=COLOR]
        [--group=GROUPNAME]
        [--time=TIMESPEC]
$ bash
bash-3.00$
  • 使用 hobbitd_alert 调试命令:成功匹配,/boot 磁盘使用率必须真正超过 16%。
bash-3.00$ bin/hobbitd_alert --debug --test t-rh9.mywork.com disk --group=APPS_TEAM_PARTITION
2007-07-23 14:38:57 Opening file /etc/opt/hobbitserver42/bb-hosts
2007-07-23 14:38:57 Opening file /etc/opt/hobbitserver42/hobbit-alerts.cfg
2007-07-23 14:38:57 Compiling regex (t-rh9).mywork.com
2007-07-23 14:38:57 Compiling regex (t-rh9).mywork.com
2007-07-23 14:38:57 send_alert t-rh9.mywork.com:DISK state 0
00018286 2007-07-23 14:38:57 send_alert t-rh9.mywork.com:DISK state Paging
00018286 2007-07-23 14:38:57 Matching host:service:page 't-rh9.mywork.com:DISK:'
 against rule line 122
00018286 2007-07-23 14:38:57 Failed 'HOST=$site02test SERVICE=cpu,disk,memory,files,telnet'
 (service not in include list)
00018286 2007-07-23 14:38:57 Matching host:service:page 't-rh9.mywork.com:DISK:'
 against rule line 125
00018286 2007-07-23 14:38:57 Failed 'HOST=$site02test SERVICE=conn' (service not in include list)
00018286 2007-07-23 14:38:57 Matching host:service:page 't-rh9.mywork.com:DISK:'
 against rule line 129
00018286 2007-07-23 14:38:57 Failed 'GROUP=UNIX_TEAM_PROCESS' (group not in include list)
00018286 2007-07-23 14:38:57 Matching host:service:page 't-rh9.mywork.com:DISK:'
 against rule line 132
00018286 2007-07-23 14:38:57 Failed 'GROUP=UNIX_TEAM_PARTITION' (group not in include list)
00018286 2007-07-23 14:38:57 Matching host:service:page 't-rh9.mywork.com:DISK:'
 against rule line 135
00018286 2007-07-23 14:38:57 Failed 'GROUP=APPS_TEAM_PROCESS' (group not in include list)
00018286 2007-07-23 14:38:57 Matching host:service:page 't-rh9.mywork.com:DISK:'
 against rule line 138
00018286 2007-07-23 14:38:57 *** Match with 'GROUP=APPS_TEAM_PARTITION' ***
2007-07-23 14:38:57 Found a first matching rule
00018286 2007-07-23 14:38:57 Matching host:service:page 't-rh9.mywork.com:DISK:'
 against rule line 138
00018286 2007-07-23 14:38:57 *** Match with 'GROUP=APPS_TEAM_PARTITION' ***
2007-07-23 14:38:57   repeat t-rh9.mywork.com|DISK|mail|site02unix-admin-
 [email protected] at 0
2007-07-23 14:38:57   Alert for t-rh9.mywork.com:DISK to site02unix-admin-
 [email protected]
00018286 2007-07-23 14:38:57 Mail alert with command 'mailx -s "Hobbit [12345] t-rh9.mywork.com:DISK
 CRITICAL (RED)" [email protected]'
2007-07-23 14:38:57 No more secondary matching rule
bash-3.00$
  • 从“匹配项”关键字查找匹配的精确规则。
  • 另一个检查,Xvnc 进程限制必须真正触发。
bash-3.00$ bin/hobbitd_alert --debug --test t-rh9.mywork.com PROC  --group=APPS_TEAM_PARTITION
2007-07-23 14:55:38 Opening file /etc/opt/hobbitserver42/bb-hosts
2007-07-23 14:55:38 Opening file /etc/opt/hobbitserver42/hobbit-alerts.cfg
2007-07-23 14:55:38 Compiling regex (t-rh9).mywork.com
2007-07-23 14:55:38 Compiling regex (t-rh9).mywork.com
2007-07-23 14:55:38 send_alert t-rh9.mywork.com:PROC state 0
00018526 2007-07-23 14:55:38 send_alert t-rh9.mywork.com:PROC state Paging
00018526 2007-07-23 14:55:38 Matching host:service:page 't-rh9.mywork.com:PROC:'
 against rule line 122
00018526 2007-07-23 14:55:38 Failed 'HOST=$site02test SERVICE=cpu,disk,memory,files,telnet'
 (service not in include list)
00018526 2007-07-23 14:55:38 Matching host:service:page 't-rh9.mywork.com:PROC:'
 against rule line 125
00018526 2007-07-23 14:55:38 Failed 'HOST=$site02test SERVICE=conn' (service not in include list)
00018526 2007-07-23 14:55:38 Matching host:service:page 't-rh9.mywork.com:PROC:'
 against rule line 129
00018526 2007-07-23 14:55:38 Failed 'GROUP=UNIX_TEAM_PROCESS' (group not in include list)
00018526 2007-07-23 14:55:38 Matching host:service:page 't-rh9.mywork.com:PROC:'
 against rule line 132
00018526 2007-07-23 14:55:38 Failed 'GROUP=UNIX_TEAM_PARTITION' (group not in include list)
00018526 2007-07-23 14:55:38 Matching host:service:page 't-rh9.mywork.com:PROC:'
 against rule line 135
00018526 2007-07-23 14:55:38 Failed 'GROUP=APPS_TEAM_PROCESS' (group not in include list)
00018526 2007-07-23 14:55:38 Matching host:service:page 't-rh9.mywork.com:PROC:'
 against rule line 138
00018526 2007-07-23 14:55:38 *** Match with 'GROUP=APPS_TEAM_PARTITION' ***
2007-07-23 14:55:38 Found a first matching rule
00018526 2007-07-23 14:55:38 Matching host:service:page 't-rh9.mywork.com:PROC:'
 against rule line 138
00018526 2007-07-23 14:55:38 *** Match with 'GROUP=APPS_TEAM_PARTITION' ***
2007-07-23 14:55:38   repeat t-rh9.mywork.com|PROC|mail|
 [email protected] at 0
2007-07-23 14:55:38   Alert for t-rh9.mywork.com:PROC to
 [email protected]
00018526 2007-07-23 14:55:38 Mail alert with command 'mailx -s "Hobbit [12345] t-rh9.mywork.com:PROC
 CRITICAL (RED)" [email protected]'
2007-07-23 14:55:38 No more secondary matching rule
bash-3.00$

问:如何在 Solaris 上使 trimhistory 对 hobbit 服务器生效?

[编辑 | 编辑源代码]

答:hobbit 手册页 中的默认示例适用于 Linux 上的 hobbit 服务器。

问:如何从 NK 概览页面中排除“信息”和“趋势”列?

[编辑 | 编辑源代码]

答:从 Hobbitd 4.12 开始,目前硬编码为“信息”和“趋势”列显示在所有页面上,包括 NK 和 BB2 页面。如果要删除这些列,则需要编辑 Hobbit 源代码。更改非常简单。在 hobbit-4.1.2/bbdisplay/pagegen.c 文件中,第 121-123 行看起来像这样

/* TRENDS and INFO columns are always included on non-BB pages */
if (strcmp(column->name, xgetenv("INFOCOLUMN")) == 0) return 1;
if (strcmp(column->name, xgetenv("TRENDSCOLUMN")) == 0) return 1;

将两行上的“return 1”更改为“return 0”,保存文件,运行“make”,然后运行“make install”或将 bbdisplay/bbgen 程序复制到 ~hobbit/server/bin/ 。下次 NK 页面更新时,这些列将消失。

问:如何使用 Hobbit 的内部 HTTP 测试功能来测试 Squid 代理服务器?

[编辑 | 编辑源代码]

答:如果要检查服务是否真正正常运行,请在 bb-hosts 文件中使用类似以下内容

0.0.0.0   squid.domain.com   # http://squid.domain.com:8080/http://www.google.com/

问:如何使用 Hobbit 的内部 HTTP 测试功能来测试对 Windows 域进行身份验证的代理服务器?

[编辑 | 编辑源代码]

答:如果要检查服务是否真正正常运行,请在 bb-hosts 文件中使用类似以下内容

0.0.0.0   servername.domain.com   # \
    http://domain\username:[email protected]:8080/http://www.google.com/

问:如何在一个页面上比较来自不同主机的图表?

[编辑 | 编辑源代码]

答:从 Hobbitd 4.12 开始,目前没有前端来构建图表所需的 URL,但您可以手动为所有具有 _multi 定义的图表(例如平均负载、交换)执行此操作。

  1. 找到您要使用的基本图表,例如其中一个主机的 CPU“平均负载”图表。
  2. 在浏览器中,右键单击图表并选择“查看图像”或“打开图像”。现在您只能看到负载图表。
  3. 在地址栏字段中,您将看到此图像的 URL。例如
http://hobbit.domain.com/hobbit-cgi/hobbitgraph.sh?host=host1.domain.com&service=la\
&graph_width=576&graph_height=120&disp=host1%2edomain%2ecom&nostale&graph=hourly&action=view

现在,您可以在 URL 的“host=...”部分之后添加更多主机 - 只需将所有主机用逗号隔开即可。就像

http://hobbit.domain.com/hobbit-cgi/hobbitgraph.sh?host=host1.domain.com,host2.domain.com,\
host3.domain.com&service=la&graph_width=576&graph_height=120&disp=host1%2edomain%2ecom&nostale&\
graph=hourly&action=view

问:我刚刚从 BigBrother 客户端升级到 Hobbit 客户端,但我没有收到任何关于 CPU 或磁盘的状态,但收到了其他测试的状态。

[编辑 | 编辑源代码]

答:最常见的原因是客户端使用的主机名与 bb-hosts 文件中的主机名不同。在客户端上,"uname -n" 命令报告的主机名是什么?如果这与 bb-hosts 文件中的主机名不同,请使用“--hostname=THE.REAL.HOSTNAME”选项启动客户端。

问:如何修复“来自 192.168.1.31 的超大状态消息,用于 test.my.com:端口被截断(n=508634,limit=262144)”?

[编辑 | 编辑源代码]

A.

尝试增加 ~server/etc/hobbitserver.cfg 中 MAXMSG_STATUS 的值。

MAXMSG_STATUS
   The maximum size of a "status" message in kB, default: 256. Status
   messages are the ones that end up as columns on the web display. The
   default size should be adequate in most cases, but some extension
   scripts can generate very large status messages - close to 1024 kB.
   You should only change this if you see messages in the hobbitd log
   file about status messages being truncated.

limit=262144 为 256kB。您可以将 n 值除以 1024(508634/1024 = 496),然后可以将 MAXMSG_STATUS 设置为“500”并重新启动 hobbit 服务器。

B.

On Wed, May 03, 2006 at 03:43:19PM +0200, Dominique Frise wrote:
> Hi,
> 
> ----hobbitd.log----
> 2006-05-03 12:34:27 Oversize data/client msg from 130.223.5.20 truncated 
> (n=815825, limit 524288)
> First line: godzilla|sunos

"godzilla" - a Solaris host - sent a too-large "client" message of
815825 bytes. There's a limit set in Hobbit for the size of client
message at 512 KB, so the message was truncated.

> [bb (at) iris hobbit]$ cat clientdata.log
> 2006-05-03 12:34:28 Worker process died with exit code 0, terminating

This is interesting. If the truncated message caused hobbitd_client to
crash, I would have expected a different exit-code. I'll have to check 
how it handles truncated messages.

> How can this happend?

Dont know, but apparently some input from your host caused it.

> Has this been fixed in latest snapshot?

Probably not. Which version are you running?

> Which worker process died? (hobbitd_client is still running)

It's restarted automatically by hobbitlaunch.

Henrik
  • 我们需要调查为什么 hb 客户端消息超大。就像以下内容一样,我们发现我们有 msg.*.txt 文件,其大小超过 512k。对于系统的 bb 消息采样来说,这是不正常的。
bash-3.00# wc msg.k206.test.com.txt
    7943   55662  611936 msg.k206.test.com.txt
bash-3.00# ls -l  msg.k206.test.com.txt
-rw-r--r--   1 hobbitc  hobbitc   611936 May  2 18:35 msg.v04k206.test.com.txt
bash-3.00#

  • 进一步调查发现,msg.*.txt 的 [ports] 部分包含来自两个“netstat -na”命令的太多输出。
bash-3.00# grep netstat /opt/hobbitclient42/bin/hobbitclient-sunos.sh
netstat -rn
echo "[netstat]"
netstat -s
netstat -na -f inet -P tcp | tail +3
netstat -na -f inet6 -P tcp | tail +5
bash-3.00#

[编辑 | 编辑源代码]

答:它不可配置,但在 hobbit-4.2.0/web/hobbitgraph.c 文件的顶部附近,您会找到以下几行

 #define HOUR_GRAPH  "e-48h"
 #define DAY_GRAPH   "e-12d"
 #define WEEK_GRAPH  "e-48d"
 #define MONTH_GRAPH "e-576d"

更改它们以适合您。然后在同一个文件中搜索更下方的 HOUR_GRAPH 等;您会在一个地方找到每个地方,如下所示

 period = HOUR_GRAPH;
 persecs = 48*60*60;

您还需要为所有 4 种图表类型更改“persecs”计算。

更改图例

 //persecs = 12*24*60*60;
 persecs = 7*24*60*60;
 //glegend = "Last 12 Days";
 glegend = "Last 7 Days";

然后运行“make”(从 hobbit-4.2.0 目录)和“make install”(或仅将“web/hobbitgraph.cgi”文件复制到您的 ~hobbit/server/bin/ 目录)。

图表常见问题解答

[编辑 | 编辑源代码]

问:为什么我的 Hobbit 服务器具有以下 http 响应图表?

[编辑 | 编辑源代码]

为什么 http 服务的响应时间差异如此之大。这是 http 服务器配置错误吗?
A trending of http response time.

答:数百种原因会导致 http 服务器延迟。我们看到图表仅在 2 到 10 毫秒范围内有所不同。这是很正常的。由于自动缩放,图表差异看起来比实际更重要或更剧烈。

[编辑 | 编辑源代码]

A trending of bge0 network traffic.

答:传入流量远大于传出流量,这是正常的。Hobbit 服务器从客户端接收大量 bb/hb 消息。

问:这些 wrsmd* 接口是什么?

[编辑 | 编辑源代码]

答:wrsmd(7D)(WCI 远程共享内存 (WRSM) DLPI 驱动程序)状态由 Solaris 10 命令 "/usr/bin/kstat -p -s '[or]bytes64'" 报告,该命令用于 hobbitclient-sunos.sh 中的 [ifstat]。我说“曾经”,因为在我们所有打了补丁的 Solaris 10 服务器上,我们已经很久没有看到这种情况了。

您可以通过使用 "/usr/bin/kstat -p -s '[or]bytes64' | grep -v wrsmd | sort" 来避免此输出,用于 [ifstat]。您还需要删除所有 ifstat.wrsmd*.rrd 文件。

Dominique UNIL - 洛桑大学

问:更正后的图表

[编辑 | 编辑源代码]

wrsmd 接口现在已从图表中消失。

A trending of bge0 network traffic without wrsmd* intefaces.

问:如何使用 Hobbit/BBWin 客户端在网络接口上收集 Bit/s?

[编辑 | 编辑源代码]

答:我对这个问题很感兴趣,但还没有找到答案。

错误 FAQ

[编辑 | 编辑源代码]

semop 失败,无效参数?

[编辑 | 编辑源代码]

答:当 hobbit 非正常退出时经常出现。停止 Hobbit,然后运行,

         # ipcs |grep hobbit
         0x0100ba76 162758665  hobbit    600        262144     2
         0x0200ba76 162791434  hobbit    600        262144     2
         And remove any remaining shared memory segments.
         # ipcrm -M 0x0200ba76
bash-3.00# tail hobbitd.log
2008-02-18 12:28:00 semop failed, Invalid argument
2008-02-18 12:28:00 How did this happen? clients=-1, s.sem_op=0
2008-02-18 12:28:00 semop failed, Invalid argument
2008-02-18 12:28:00 How did this happen? clients=-1, s.sem_op=0
2008-02-18 12:28:00 semop failed, Invalid argument
2008-02-18 12:28:00 How did this happen? clients=-1, s.sem_op=0
2008-02-18 12:28:00 semop failed, Invalid argument
2008-02-18 12:28:00 How did this happen? clients=-1, s.sem_op=0
2008-02-18 12:28:00 semop failed, Invalid argument
2008-02-18 12:28:00 How did this happen? clients=-1, s.sem_op=0
bash-3.00#
bash-3.00#

华夏公益教科书