- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有 Solaris 10 + Zenoss 2.7.0,如果没有 Oracle 许可证,我无法升级它,因此我尝试寻找解决方法,这就是我请求您帮助的原因。
对于过去 5 分钟内收到的来自同一设备的任何事件,我需要防止事件移动到历史表中,然后如果计数超过 5,则删除事件。
这就是我尝试做的(映射放置在 /Unknown/linkUp 中)
try:
import Globals
import sys
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
except Exception as error:
logging.error('ApplyTestZSB. Cannot import ZenScriptBase: %s\n' % error)
sys.exit(1)
dmd = None
try:
dmd = ZenScriptBase(connect=True).dmd
except Exception as error:
logging.error(
'ApplyTestDMD. Connection to zenoss dmd failed: %s\n' % error)
sys.exit(1)
ourMessage = str(getattr(evt, "message"))
ourDevice = str(evt.device)
ourLastTime = float(evt.lastTime)
old_elements = 0
if evt.device and evt.component and evt.eventClass and evt.eventKey:
ourDedupId = '|'.join(
[evt.device, evt.component, evt.eventClass, evt.eventKey, ''])
for event in dmd.ZenEventManager.getEventList():
if (event.lastTime > ourLastTime - 301) and \
((ourDedupId in str(event.dedupid) and event.severity > 0) or
(ourMessage == event.message and ourDevice == event.device)):
old_elements += event.count
if old_elements > 4:
evt._action = 'drop'
我在 zenhub.log 中遇到此错误:
2013-06-15 21:21:11 ERROR zen.Events: Error transforming EventClassInst linkUp (1)
2013-06-15 21:21:20 ERROR root: ApplyTestDMD. Connection to zenoss dmd failed: 2
2013-06-15 21:21:20 ERROR zen.Events: Error transforming EventClassInst linkUp (1)
2013-06-15 21:21:24 ERROR root: ApplyTestDMD. Connection to zenoss dmd failed: 2
2013-06-15 21:21:24 ERROR zen.Events: Error transforming EventClassInst linkUp (1)
2013-06-15 21:21:28 ERROR root: ApplyTestDMD. Connection to zenoss dmd failed: 2
2013-06-15 21:21:28 ERROR zen.Events: Error transforming EventClassInst linkUp (1)
最佳答案
从脚本中完全删除 dmd,它已在执行事件转换期间在 locals() 中定义。不需要自己定义,就像evt已经定义了一样。
要亲自查看,请定义以下一行事件转换,然后使用事件控制台添加按钮为刚刚为其创建转换的事件类添加新事件,以快速测试:
evt.summary = str('dmd' in locals())
您应该会看到事件摘要中出现 True,这意味着 dmd 已定义并可供使用:)
关于python - 如何在 Zenoss 映射中导入 DMD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17126119/
我编译文件 stacktrace.d:void main(){assert(false);} 关闭 ASLR,运行时我得到: core.exception.AssertError@stacktrace
我正在尝试在 Windows 中使用 DMD 编译器本身(没有 IDE)构建一个项目。而且我发现自己几乎无法意识到有关链接的某些时刻。通常 IDE 会为我做这件事。 我的项目结构 project ├─
我目前正在试用DerelictSDL2 (绑定(bind)到 D 的 SDL2 库)并且我编写了一个成功加载 JPG 图像并将其显示在窗口中的代码。也就是说,当它使用 dmd 编译时。当我尝试使用 g
我可以测试 DMD 是否正在使用 version(DMD){} 编译给定的代码,但我如何检查它的哪个版本? (2.66/2.65 等) 更简洁地说,我想检查 @nogc修饰符存在, 如果不是 - 定义
根据 http://dlang.org/statement.html 的“Foreach 限制”部分以下代码 int[] a; int[] b; foreach (int i; a) { a
有时 SciTE(以及程序员记事本)会停止处理 DMD.exe 输出的错误消息。 我发现,他们都无法跳转到 game.d 中的第 81 行:“game.d(81):一些错误” 而这个有效:“game.
这里我想锁步迭代两个 size_t 数组 import std.stdio; import std.range; import std.exception; import std.conv; stru
人们一直试图用旧版本的 Dmd 和 Dub(0.9.2 而不是 1.0.0)来构建我的项目,但它不起作用。我可以在 dub.json 文件中指定所需的最小配音版本吗? 最佳答案 不幸的是你不能。见 t
我有一个名为“dprogram.d”的 d 源文件,并在 mac osx 的终端中使用命令 $ dmd dprogram.d 创建一个可执行文件。根据官方文档,编译器将自动编译源代码并链接 .o 目标
根据 http://dlang.org/statement.html 的“Foreach 限制”部分以下代码 int[] a; int[] b; foreach (int i; a) { a
我是 D 编程新手。选择 DMD (2.061) 或 GDC(4.6、4.7 或 4.8,快照)的优缺点是什么?我应该选择哪个 GDC 版本?我已经成功构建了 GCC-4.8 和 GDC-4.8 的最
我在 D 中有一个模板类,它以另一个模板作为参数,它是这样开始的: class RuleVars(alias RuleType, RuleRange, SubstitutionRange) if (_
我有一个名为“dprogram.d”的 d 源文件,并在 mac osx 的终端中使用命令 $ dmd dprogram.d 创建一个可执行文件。根据官方文档,编译器将自动编译源代码并链接 .o 目标
每当我使用 DMD 构建静态库时,我都能够将它链接到我的应用程序并且编译正常,但是在应用程序中调用库的任何时候我都会得到: Segmentation fault (core dumped) 为了构建我
我正在尝试安装 DMD,因此完全遵循此页面上提供的建议:http://dlang.org/dmd-osx.html .但是,当我尝试构建 .d 文件时出现错误: 这是我的hello.d import
我有 Solaris 10 + Zenoss 2.7.0,如果没有 Oracle 许可证,我无法升级它,因此我尝试寻找解决方法,这就是我请求您帮助的原因。 对于过去 5 分钟内收到的来自同一设备的任何
我只是从 http://www.digitalmars.com/d/download.html 安装了 DMD 编译器对于 Ubuntu 64 位 (dmd_2.055-0_amd64.deb)。但是
有人在 Snow Leopard 上试过 Digitalmars D 编译器(第 2 版)吗?我想升级,但我宁愿有一个可用的 D 编译器。 最佳答案 如果您仍然不确定,请深呼吸并开始尝试: Chang
我想部分等效的问题:使用 DMD 编译的代码是否应该在所有情况下使用 GDC 自动编译? 我问是因为我在从 ubuntu 10.4(看似循环依赖,叹气)存储库安装现代版本的 GDC 时遇到问题。 最佳
当我import etc.c.curl; DMD 告诉我 Warning 2: File Not Found curl.lib 这个 curl.lib 在哪里? (我尝试了 http://curl.h
我是一名优秀的程序员,十分优秀!