Zabbix3.4支持的触发器函数

10.1 支持的触发器函数

trigger expressions 可用的函数列出如下。

函数
描述 参数 说明
abschange
最近获取值与之前获取值差的绝对值。 支持值的类型: float, int, str, text, log

例如:
(最近获取值;之前获取值=abschange)
1;5=4
3;1=2
0;-2.5=2.5

返回值:
0 – 两值相等
1 – 两值不等

avg (sec|#num,<time_shift>)
指定评估期内一个项目的平均值。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示
time_shift (可选) – 时间偏移
支持值的类型: float, int

例如:
⇒ avg(#5) → 五个最新值的平均值
⇒ avg(1h) → 一个小时的平均值
⇒ avg(1h,1d) → 一天前一个小时的平均值。

从Zabbix 1.8.2开始支持time_shift参数。当需要比较当前平均值和指定时间之前的平均值(由time_shift参数指定)时,它就很有用了。

band (sec|#num,mask,<time_shift>)
项目值和掩码的按位与值。 sec (可省略) or #num – 最新的第N个值
mask (必须有) – 64位无符号整数 (0 – 18446744073709551615)
time_shift (可选) – 参照 avg()
支持值的类型: int

注意此处的 #num 参数和其它一些函数的作用不用 (参照 last()).

尽管以二进制方式进行比较,但是所有的参数和返回值都是十进制数。 例如, 检查第三位是和4做比较而不是100。

例如:
⇒ band(,12)=8 or band(,12)=4 → 第三位和第四位被设置,但不是同时
⇒ band(,20)=16 → 第三位没有被设置但是第五位被设置了。

从Zabbix 2.2.0开始支持该函数。

change
最近获取值与之前获取值的差。 支持的值类型: float, int, str, text, log

例如:
(最近获取值;之前获取值=change)
1;5=+4
3;1=-2
0;-2.5=-2.5

返回值:
0 – 两值相等
1 – 两值不等

count (sec|#num,<pattern>,<operator>,<time_shift>)
指定评估期内值的个数。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示
pattern (可选) – 所需模式 (整型项目 – 精确匹配; 浮点型项目 – 误差值0.000001内)
operator (可选)

支持的 operators:
eq – 相等
ne – 不相等
gt – 大于
ge – 大于等于
lt – 小于
le – 小于等于
like – 只要包含pattern (区分大小写)就被匹配
band – 按位与
regexp – 给定 pattern 的正则表达式,区分大小写
iregexp – 给定 pattern 的正则表达式,不区分大小写

注意:
eq (默认), negtgeltlebandregexpiregexp 支持整数型项目
eq (默认), negtgeltleregexpiregexp支持浮点型项目
like (默认), eqneregexpiregexp支持string, text and log 型项目

time_shift (可选) – 参照 avg()

支持值的类型: float, int, str, text, log

band 做第三个参数时,第二个 pattern 参数可以用两个数字表示, 以’/’分隔: number_to_compare_with/mask。 count() 计算项目值和掩码的按位与,再和 number_to_compare_with 比较的结果。如果按位与值等于 number_to_compare_with ,则计数。
如果掩码值等于 number_to_compare_with, 只需要指定掩码值。

regexp 或 iregexp 做为第三个参数时,第二个 pattern 参数可以是一个普通的或 global ( ‘@’ 开头)的正则表达式。 避免全局表达式大小写敏感从全局表达式设置中继承。为了方便正则匹配,浮点型数值通常以四位小数方式表示。也应该注意大数值在以十进制(存储在数据库中)和二进制(zabbix server中使用)表示中的区别,可能会影响十进制的第四位小数。

例如:
⇒ count(10m) → 过去10分钟值的个数
⇒ count(10m,12) → 过去10分钟值等于12的个数
⇒ count(10m,12,”gt”) → 过去10分钟值大于12的个数
⇒ count(#10,12,”gt”) → 最新10个值,它们的值大于12的个数
⇒ count(10m,12,”gt”,1d) → 一天前的前十分钟值大于12的个数
⇒ count(10m,6/7,”band”) → 过去10分钟值最低三个有效位是 ‘110’ (十进制)的个数。
⇒ count(10m,,,1d) → 一天前的前十分钟值的个数

从Zabbix 1.6.1开始支持#num参数。
从Zabbix 1.8.2开始支持time_shift参数和字符串运算符。
从Zabbix 2.2.0开始支持band运算符。
从Zabbix 3.2.0开始支持regexpiregexp运算符。

date
当前日期,以YYYYMMDD格式表示。 支持值的类型: any

返回值如: 20150731

dayofmonth
当前是本月的第几天,取值范围从1到31。 支持值的类型: any

从Zabbix 1.8.5开始支持该函数。

dayofweek
当前是本周的第几天,取值范围从1到7 (周一 – 1, 周日 – 7). 支持值的类型: any
delta (sec|#num,<time_shift>)
指定评估期内最大值和最小值的差(‘max()’ 减去 ‘min()’)。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示
time_shift (可选) – see avg()
支持值的类型: float, int

从Zabbix 1.8.2开始支持time_shift参数。

diff
比较最近获取值与之前获取值是否相同. 支持值的类型: float, int, str, text, log

返回值:
1 – 两值不等
0 – 两值相等

forecast (sec|#num,<time_shift>,time,<fit>,<mode>)
项目的未来值,最大值,最小值,差值或平均值。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示
time_shift (可选) – see avg()
time – 需要进行估计的指定时间
fit (可选) – 用于匹配历史数据的函数

支持的fits:
linear – 线性函数
polynomialN – n次多项式 (1 <= N <= 6)
exponential – 指数函数
logarithmic – 对数函数
power – 幂函数

注意:
默认是linear , polynomial1 等同于 linear

mode (可选) – demanded output

支持的 modes:
value – 值 (默认)
max – 最大值
min – 最小值
delta – 最大值-最小值
avg – 平均值

注意:
value 估计项目值在此刻now + time
maxmindelta and avg 根据now 和 now + time 时间段估计的项目值确定结果

支持值的类型: float, int

如果返回值大于 999999999999.9999 或者小于 -999999999999.9999, 返回值相应被设置为999999999999.9999 或 -999999999999.9999 。

只有在表达式被误用时才不被支持(错误的项目类型,无效的参数),出现错误时返回-1。

例如:
⇒ forecast(#10,,1h) → 根据最新的十个值估计一小时后的项目值
⇒ forecast(1h,,30m) → 根据过去一小时的值估计三十分钟后的项目值
⇒ forecast(1h,1d,12h) → 根据一天前的一个小时值估计十二个小时后的项目值
⇒ forecast(1h,,10m,exponential) → 根据过去一小时并按照指数函数方式估计十分钟后的项目值
⇒ forecast(1h,,2h,polynomial3,max) → 根据过去一小时并按照三次多项式方式估计两小时的最大项目值
⇒ forecast(#​2,,​-20m) → 根据最新的两个值估计二十分钟前的项目值 (比使用last()或prev()函数更加精确, 特别是项目很少更新的时候, 比如说, 一小时一次)

从Zabbix 3.0.0开始支持该函数。
​从Zabbix 3.0.6 和 3.2.2开始支持负的​time值。
通过 predictive trigger functions查看扩展信息。

fuzzytime (sec)
检查项目时间戳和zabbix服务器时间相差多大。 sec – 秒数 支持值的类型: float, int

返回值:
0 – 如果项目时间戳和zabbix服务器时间戳之间相差超过指定的时间
1 – 其它。

常使用system.localtime来检查本地时间是否与zabbix服务器的时间相同。
也可以使用vfs.file.time[/path/file,modify]键值检测文件是否长时间未更新。

例如:
⇒ fuzzytime(60)=0 → 如果时间差超过60秒,就会检测到一个问题

iregexp (pattern,<sec|#num>)
该函数和 regexp() 类似,只是不区分大小写。 see regexp() 支持值的类型: str, log, text
last (sec|#num,<time_shift>)
最近的值。 sec (可省略) or #num – 最新的第N个值
time_shift (可选) – see avg()
支持值的类型: float, int, str, text, log

注意此处的 #num 参数和其它一些函数的作用不用。
例如:
last() 通常等同于 last(#1)
last(#3) – 第三个最新值 (不是三个最新值)

如果在history中同一秒有多个值存在,Zabbix不能保证值的精确顺序。

从Zabbix 1.6.2开始支持 #num 参数。
从Zabbix 1.8.2开始支持 time_shift 参数。

logeventid (pattern)
检查最近日志记录的EventID是否匹配正则表达式。 pattern – 使用正则表达式表示需要匹配的模式, POSIX extended 类型。 支持值的类型: log

返回值:
0 – 不匹配
1 – 匹配

从Zabbix 1.8.5开始支持该函数。

logseverity
最近日志记录的日志等级。 支持值的类型: log

返回值:
0 – 默认等级
N – 对应的等级 (整数,常用语Windows event logs: 1 – Information, 2 – Warning, 4 – Error, 7 – Failure Audit, 8 – Success Audit, 9 – Critical, 10 – Verbose).
Zabbix从Windows event log Information域获取日志等级。

logsource (pattern)
检查最近的日志记录是否匹配参数的日志来源。 pattern – string类型 支持值的类型: log

返回值:
0 – 不匹配
1 – 匹配
通常用于Windows event logs. 例如, logsource(“VMware Server”).

max (sec|#num,<time_shift>)
指定评估期内一个项目的最大值。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示
time_shift (可选) – see avg()
支持值的类型: float, int

从Zabbix 1.8.2开始支持 time_shift 参数。

min (sec|#num,<time_shift>)
指定评估期内一个项目的最小值。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示
time_shift (可选) – see avg()
支持值的类型: float, int

从Zabbix 1.8.2开始支持 time_shift 参数。

nodata (sec)
检查是否没有接收到数据。 sec – 评估期以秒值表示。
时间不应该少于30秒,因为timer处理器每30秒计算一次该函数。

nodata(0) 不被允许.

支持值的类型: any

返回值:
1 – 指定评估期没有接收到数据
0 – 其它

注意,如果在第一个参数指定的时间内出现以下问题,该函数会报错:
– 没有数据以及Zabbix server被重启
– 没有数据以及修复完成
– 没有数据以及项目被添加或重新激活
错误显示在触发器configuration的 Info 列 .

now
距离Epoch (00:00:00 UTC, January 1, 1970)时间的秒数。 支持值的类型: any
percentile (sec|#num,<time_shift>,percentage)
P-th 一段时间的百分值, P (percentage) 做为第三个参数。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示
time_shift (可选) – see avg()
percentage – 0 and 100 (包括)之间的一个浮点数,小数点后最多四位
支持值的类型: float, int

从Zabbix 3.0.0开始支持该函数。

prev
前一个值。 支持值的类型: float, int, str, text, log

返回值和 last(#2)相同。

regexp (pattern,<sec|#num>)
检查最近的值是否匹配正则表达式。 pattern – 正则表达式, POSIX extended 样式。
sec or #num (可选) – 评估期以秒值或最新值个数(跟在#号后)表示。 这种情况下,可处理一个值以上。
支持值的类型: str, text, log

返回值:
1 – 找到
0 – 其它

该函数区分大小写。

str (pattern,<sec|#num>)
从最新值中查找一个字符串。 pattern – string型
sec or #num (可选) – 评估期以秒值或最新值个数(跟在#号后)表示。 这种情况下,可处理一个值以上。
支持值的类型: str, text, log

返回值:
1 – 找到
0 – 其它

该函数区分大小写。

strlen (sec|#num,<time_shift>)
最新值的字符长度(而不是字节数)。 sec (可省略) or #num – 最新的第N个值
time_shift (可选) – see avg()
支持值的类型: str, text, log

注意此处的 #num 参数和其它一些函数的作用不用。

例如:
⇒ strlen()(等同于 strlen(#1)) → 最新值的长度
⇒ strlen(#3) → 最新的第三个值的长度
⇒ strlen(,1d) → 一天前最新值的长度。

从Zabbix 1.8.4开始支持该函数。

sum (sec|#num,<time_shift>)
指定评估期内项目值的和。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示。
time_shift (可选) – see avg()
支持值的类型: float, int

从Zabbix 1.8.2开始支持 time_shift 参数。

time
当前时间,以HHMMSS格式表示。 支持值的类型: any

返回值如: 123055

timeleft (sec|#num,<time_shift>,threshold,<fit>)
达到阀值需要多久时间。 sec or #num – 评估期以秒值或最新值个数(跟在#号后)表示。
time_shift (可选) – see avg()
threshold – 阀值
fit (可选) – see forecast()
支持值的类型: float, int

如果返回值大于 999999999999.9999, 则被设置为999999999999.9999.

如果达不到阀值则将返回值设置为999999999999.9999。

只有在表达式被误用时才不被支持(错误的项目类型,无效的参数),出现错误时返回-1。

例如:
⇒ timeleft(#10,,0) → 根据最新的十个值估计项目值达到0需要的时间
⇒ timeleft(1h,,100) → 根据过去一小时的值估计项目值达到100需要的时间
⇒ timeleft(1h,1d,0) → 根据一天前的一个小时值估计项目值达到0需要的时间
⇒ timeleft(1h,,200,polynomial2) → 根据过去一小时并按照二次多项式方式估计项目值达到200需要的时间

从Zabbix 3.0.0开始支持该函数。
从Zabbix 3.0.6 和 3.2.2开始支持Unit symbols 的 ​threshold 参数。
通过 predictive trigger functions查看扩展信息。

1) 所有函数的返回值都是数值型,而不是字符串。
2) 一些函数不能使用非整型参数!
3) 字符串参数应该加上双引号,否则可能被错误解析。

函数和不支持的项目

从Zabbix 3.2开始, nodata()date()dayofmonth()dayofweek()now() and time() 函数也归到不支持的项目里。 其它的函数需要被引用的项目处于支持状态。

Zabbix3.4汇总检查

12 汇总检查

概述

在汇总检查中,Zabbix通过直接从数据库中查询监控信息,然后进行信息聚合。

聚合检查不需要在被监控的主机上运行任何代理。

语法

聚合监控项Key的语法是:

groupfunc["host group","item key",itemfunc,timeperiod]

支持的组功能(groupfunc)是:

组功能 描述
grpavg 平均值
grpmax 最大值
grpmin 最小值
grpsum 值求和

可以通过逗号分隔的数组来包含多个主机组。指定父主机组将包括父组和所有包含监控项的嵌套主机组。

从聚合监控项Key引用的所有监控项必须存在并且正在收集数据。只有主机被启用并且监控项也被启用才能进行聚合计算。

如果引用的监控项Key被更改,则必须手动更新聚合监控项的Key。

支持的监控项的功能(itemfunc)是:

监控项功能 描述
avg 平均值
count 数值
last 最后一次的值
max 最大值
min 最小值
sum 值的和

timeperiod参数指定最近收集的值的时间段。为了方便,可以在此参数中使用支持的单位符号,例如’5m’(分钟)而不是’300’(秒)或’1d’(天)而不是’86400’(秒)。

在该时间段内不支持数值(count,前缀为#)。

如果第三个参数(监控项功能)为last,服务器将忽略时间段,因此可以省略:

groupfunc["host group","item key",last]
如果聚合产生了浮点值,同时如果聚合的监控项信息类型为Numeric(无符号),则将其修剪为整数。

如果出现以下情况有可能不支持汇总监控项:

  • 没有找到引用的监控项(如果监控项Key不正确,则不存在任何监控项或所有包含的组都不正确)
  • 没有数据用来计算一个函数

用法示例

用于聚合检查的Key示例:

示例 1

主机组’MySQL Servers’的总磁盘空间。

grpsum["MySQL Servers","vfs.fs.size[/,total]",last]
示例 2

主机组’MySQL Servers’的平均处理器负载。

grpavg["MySQL Servers","system.cpu.load[,avg1]",last]
示例 3

主机组’MySQL Servers’每秒查询值的5分钟聚合。

grpavg["MySQL Servers",mysql.qps,avg,5m]
示例 4

多个主机组中所有主机上的平均CPU负载。

grpavg[["Servers A","Servers B","Servers C"],system.cpu.load,last]

zabbix3.4日志文件监控

日志文件监控

概述

Zabbix可用于集中监控和分析具有/不具有日志转动能力的日志文件。

当日志文件包含某些字符串或字符串模式时,通知信息可用于警告用户。

要监控日志文件,必须具有:

  • Zabbix代理在主机上运行
  • 日志监控项设置
受监控的日志文件的大小限制取决于大文件支持

配置

验证代理参数

确保在代理配置文件中:

  • ‘Hostname’参数与前端的主机名匹配
  • “ServerActive”参数中的服务器被指定用于处理活动检查
监控项配置

配置一个日志 监控项:

专为日志监控项的输入:

Type 这里选择 Zabbix agent (active) 。
Key 设置:
log[/path/to/file/file_name,<regexp>,<encoding>,<maxlines>,<mode>,<output>,<maxdelay>]
或者
logrt[/path/to/file/regexp_describing_filename_pattern,<regexp>,<encoding>,<maxlines>,<mode>,<output>,<maxdelay>]
Zabbix代理将通过内容正则表达式(如果存在)过滤日志文件的条目。
如果只需要匹配行的数量:
log.count[/path/to/file/file_name,<regexp>,<encoding>,<maxproclines>,<mode>,<maxdelay>]
或者
logrt.count[/path/to/file/regexp_describing_filename_pattern,<regexp>,<encoding>,<maxproclines>,<mode>,<maxdelay>].
确保文件具有“zabbix”用户的读取权限,否则监控项状态将被设置为“不支持”。
更多细节请查看 loglog.countlogrt 和 logrt.count条目在支持的Zabbix代理监控项 Key章节。
Type of information 在这里,针对log和logrt选择Log,针对log.count和logrt.count选择Numeric (unsigned) 。
如果可选地使用output参数,则可以选择除“日志”之外的适当类型的信息。
请注意,选择非日志类型的信息将导致丢失本地时间戳。
Update interval (in sec) 该参数定义了Zabbix代理将检查日志文件中的任何更改的频率。 将其设置为1秒将确保你能尽快获得新记录。
Log time format 在此字段中,你可以选择指定用于解析日志行时间戳的模式。
如果留空,则不会解析时间戳。
支持的占位符:
y年 (0001-9999)
M月 (01-12)
d日 (01-31)
h小时 (00-23)
m分钟 (00-59)
s秒 (00-59)
例如,从Zabbix代理日志文件中查看以下行:
“ 23480:20100328:154718.045 Zabbix agent started. Zabbix 1.8.2 (revision 11211).”
它以PID的六个字符位置开始,后跟日期、时间和行的其余部分。
此行的日志时间格式为 “pppppp:yyyyMMdd:hhmmss”.
请注意,“p”和“:”字符只是占位符,只能是“yMdhms”。

重要信息

  • 服务器和代理在两个计数器中保留监控日志大小和上次修改时间(对于logrt)的跟踪。 此外:
    • 代理还在内部使用inode编号(在UNIX/GNU/Linux上)、文件索引(在Microsoft Windows上)和前512个日志文件字节的MD5的求和,以便在日志文件被截断和旋转时改进决策。
    • 在UNIX/GNU/Linux系统上,假定存储日志文件的文件系统会报告索引节点号,它可用于跟踪文件。
    • 在Microsoft Windows上Zabbix代理确定日志文件所在的文件系统类型,并使用:
      • 在NTFS文件系统上64位文件索引。
      • 在ReFS文件系统(仅从Microsoft Windows Server 2012开始支持)128位文件ID。
      • 在文件索引改变的文件系统(例如FAT32,exFAT)上,当日志文件旋转导致具有相同最近修改时间的多个日志文件时,使用fall-back(回退)算法是在不确定的条件下采取的明智方法。
    • inode号,文件索引和MD5总和由Zabbix代理在内部收集。 它们不传输到Zabbix服务器,并且在Zabbix代理停止时丢失。
    • 不要使用“touch”实用程序修改日志文件的最后修改时间,不要在以后恢复原始名称的情况下复制日志文件(这将更改文件inode号)。 在这两种情况下,文件将被视为不同的,将从头开始进行分析,这可能会导致重复的告警。
    • 如果logrt[]监控项有几个匹配的日志文件,并且Zabbix代理程序跟随其中最新的日志文件,同时最新的日志文件被删除,则在“<目录>”中会出现一条警告消息“没有文件匹配”<regexp mask>“。 Zabbix代理将忽略修改时间小于最近日期的日志文件。
  • 代理人从上一次停止的时候开始读取日志文件。
  • 在代理刚刚启动或已收到以前被禁用或不支持的监控项的情况下,已经分析的字节数(大小计数器)和最后修改时间(时间计数器)存储在Zabbix数据库中并发送到代理,以确保代理从此开始读取日志文件。
  • 每当日志文件变得小于代理已知的日志大小计数器时,计数器将重置为零,并且代理从开始位置读取日志文件。
  • 如果目录中存在多个匹配文件,且最后修改时间相同,则代理会尝试以相同的修改时间对所有日志文件进行正确分析,并避免跳过数据或分析相同的数据两次(尽管有时不能保证)。代理不承担任何特定的日志文件轮换方案。当提供具有相同修改时间的多个日志文件时,代理将以字典顺序降序处理它们。 因此,对于某些旋转方案,日志文件将按原始顺序进行分析。对于其它旋转方案,原始日志文件顺序将不会被执行,这可能导致以更改顺序报告匹配的日志文件记录(如果日志文件的上次修改时间不同,则不会发生问题)。
  • Zabbix代理处理日志文件的新记录每更新间隔秒。
  • Zabbix代理不会每秒发送超过日志文件的最大值。 该限制可防止网络和CPU资源的重载,并覆盖代理配置文件中由MaxLinesPerSecond参数提供的默认值。
  • 要找到所需的字符串,Zabbix将处理比MaxLinesPerSecond中设置的新行多4倍。 因此,如果log[]或logrt[]监控项的更新间隔为1秒,则默认情况下,代理将分析不超过80个日志文件记录,并在一次检查中向Zabbix服务器发送不超过20个匹配记录。通过在代理配置文件中增加MaxLinesPerSecond或在监控项Key中设置maxlines参数,可以在一次检查中将限制最多增加4000个分析的日志文件记录和1000个匹配记录发送到Zabbix服务器。如果更新间隔设置为2秒,则一次检查的限制将被设置为更新间隔1秒的2倍。
  • 此外,日志和日志计数值始终限于代理发送缓冲区大小的50%,即使其中没有非日志值。 因此,为了在一个连接(而不是几个连接)中发送最大值,代理BufferSize参数必须至少为maxlines x 2。
  • 在没有日志监控项的情况下,所有代理缓冲区大小都用于非日志值。 当日志值进入时,根据需要替换较旧的非日志值,最多指定为50%。
  • 对大于256kB的日志文件记录,只有第一个256kB与正则表达式匹配,其余的记录将被忽略。 但是,如果Zabbix代理在处理长记录时停止,代理内部状态将丢失,并且可以在代理重新启动后再次分析不同的长记录。
  • “\”路径分隔符的特殊注意事项:如果file_format是“file\.log”,则不应该有“file”目录,因为不可能明确地定义是否转义了“.”,以及是否为第一个文件名符号。
  • 仅在文件名中支持logrt的正则表达式,不支持目录正则表达式匹配。
  • 在UNIX平台上,如果要找的日志文件的目录不存在,则logrt[]监控项将变为NOTSUPPORTED。
  • 在Microsoft Windows上,如果目录不存在,则监控项将不会变为NOTSUPPORTED(例如,如果目录在监控项Key中拼写错误)。
  • 没有用于logrt[]监控项的日志文件不会使其NOTSUPPORTED。读取logrt[]监控项的日志文件的错误将作为告警记录到Zabbix代理日志文件中,但不要使监控项NOTSUPPORTED。
  • Zabbix代理日志文件可以帮助你找出为什么log[]或logrt[]监控项成为NOTSUPPORTED。Zabbix可以监视其代理日志文件,除了在DebugLevel=4时。

提取正则表达式的匹配部分

有时我们可能只想从目标文件中提取感兴趣的值,而不是在找到正则表达式匹配时返回整行。

自Zabbix 2.2.0以后,日志监控项有能力从匹配的行提取所需的值。这通过log和logrt监控项中的附加输出参数来实现。

使用’output’参数允许指示我们可能感兴趣的匹配的子组。

例如

log[/path/to/the/file,"large result buffer allocation.*Entries: ([0-9]+)",,,,\1]

应该可以返回在以下内容中找到的条目数:

Fr Feb 07 2014 11:07:36.6690 */ Thread Id 1400 (GLEWF) large result
buffer allocation - /Length: 437136/Entries: 5948/Client Ver: >=10/RPC
ID: 41726453/User: AUser/Form: CFG:ServiceLevelAgreement

The reason why Zabbix will return only the number is because ‘output’ here is defined by \1 referring to the first and only subgroup of interest: ([0-9]+) Zabbix只返回数字的原因是因为这里的’output’是由\1定义的,指的是第一个也是唯一的想要的子组:([0-9]+)

而且,通过提取和返回数字的能力,该值可用于定义触发器。

使用maxdelay参数

日志监控项中的“maxdelay”参数允许忽略日志文件中的一些较旧的行,以便在“maxdelay”秒内获取最近分析的行。

指定’maxdelay’>0可能导致忽略重要的日志文件记录和错过的报警。只有在必要时才使用。

默认情况下,日志监控项将跟踪出现在日志文件中的所有新行。 但是,有些应用程序在某些情况下开始在其日志文件中写入大量的消息。例如,如果数据库或DNS服务器不可用,则此类应用程序会将数千个几乎相同错误消息的日志文件像洪水般爆发出来,直到恢复正常操作。默认情况下,所有这些消息将被完全分析,并将匹配的行发送到配置为“log”和“logrt”监控项的服务器。

内置防过载保护包括一个可配置的“maxlines”参数(保护服务器免受太多进入匹配的日志行)和4*’maxlines限制(保护主机CPU和I/O免受代理在一次检查中的过载)。然而,内置保护有两个问题。 首先,向服务器报告大量潜在的不太有用的消息,并消耗数据库中的空间。 第二,由于每秒分析的线路数量有限,代理可能落后于最新的日志记录数小时。 你可能希望尽快了解日志文件中的当前情况,而不是检查数小时的历史记录。

这两个问题的解决方案是使用’maxdelay’参数。 如果指定’maxdelay’> 0,则在每次检查期间,测量处理的字节数、剩余字节数和处理时间。 从这些数字中,代理计算估计延迟 – 分析日志文件中所有剩余记录所需的秒数。

如果延迟不超过“maxdelay”,则代理程序会照常分析日志文件。

如果延迟大于“maxdelay”,代理将通过“跳过”到新的估计位置来忽略日志文件块,以便可以在“maxdelay”秒内分析剩余的行。

请注意,代理甚至不会将忽略的行读入缓冲区,而是计算要在文件中跳转的大致位置。

跳过日志文件行的事实记录在代理日志文件中,如下所示:

14287:20160602:174344.206 item:"logrt["/home/zabbix32/test[0-9].log",ERROR,,1000,,,120.0]"
logfile:"/home/zabbix32/test1.log" skipping 679858 bytes
(from byte 75653115 to byte 76332973) to meet maxdelay

“to byte”数字是近似值,因为在“跳转”之后,代理将文件中的位置调整到可能在文件中更早的日志行的开头。

根据增长速度与分析日志文件的速度的不同,你可能会看到没有“jumps”、少有或经常“jumps”、大或小的“jumps”,甚至每次检查中的“jumps”都很小。系统负载和网络延迟的波动也会影响延迟的计算,因此“jumps”可以跟上“maxdelay”参数。

不建议设置 ‘maxdelay’ <‘update interval’(这可能会导致频繁的“jumps”)。

代理和服务器之间的通信失败时的操作

来自log[]和logrt[]监控项的每个匹配行以及每个log.count[]和logrt.count[]监控项检查的结果都需要代理发送缓冲区中指定的50%区域中的空闲时隙。缓冲区元素定期发送到服务器(或代理服务器),缓冲区可以再次释放。

虽然代理发送缓冲区中的指定日志区域中有空闲时隙,并且代理和服务器(或代理服务器)之间的通信失败,但是日志监控结果在发送缓冲区中累积。这有助于缓解短暂的通信故障。

在更长的通信故障期间,所有日志插槽都被占用,并采取以下措施:

  • log[]和logrt[]监控项检查已停止。当通信恢复并且缓冲器中的空闲插槽可用时,从先前的位置恢复检查。若没有匹配的行丢失,稍后再报告。
  • 如果maxdelay=0(默认),则log.count[]和logrt.count[]监控被停止。 这种行为类似于上述的log[]和logrt[]监控项。 请注意,这可能会影响log.count[]和logrt.count[]结果:例如,一次检查计算出日志文件中有100个匹配行,但是由于缓冲区中没有空闲插槽,因此停止检查。 当通信恢复时,代理计数相同的100条匹配行,还有70条新的匹配行。 代理会发送count=170,就好像它们在一次检查中发现的一样。
  • log.count[]和logrt.count[]检查与maxdelay>0:如果在检查期间没有“跳转”,则行为类似于上述。 如果在日志文件行上发生“跳转”,则保留“跳转”之后的位置,同时计算结果被丢弃。 因此,即使在通信失败的情况下,代理也试图跟上越来越多的日志文件。

Zabbix3.4触发器表达式

2 触发器表达式

概述

触发器中使用的表达式是非常灵活的。你可以使用他们去创建关于监控统计的复杂逻辑测试。

一个简单有效的表达式看起来像:

{<server>:<key>.<function>(<parameter>)}<operator><constant>

3.1 函数

触发器函数允许引用收集的值,当前时间和其他因素。

可以使用的被支持函数的完整列表。

3.2 函数参数

大多数数字型的函数接受秒数来作为参数。

你可以使用前缀#来指定参数具有不同的含义:

函数内容 含义
sum(600) 600秒内所有值的总和
sum(#5) 最后5个值的总和

函数last当以#作为前缀使用时,值具有不同的含义,它会让她会选择第N个的上一个值,所以给定值3、7、2、6、5(按照时间顺序,第一个值3为最新值),last(#2) 将返回值为7 ,last(#5) 将返回值为5

avgcountlastmin and max 函数支持额外的第二个参数time_shift(时间偏移量)。这个参数允许从过去一段时间内引用数据。例如,avg(1h,1d)将会返回一天前1小时的平均值。

触发器需要使用history历史数据来计算。如果历史数据不可用(特别是关于time_shift时间偏移量),则无法使用趋势信息,因此必须至少保持触发器函数所预期这段时间的历史信息。

你可以在触发器表达式中使用支持的单位符号,例如“5m”(分钟)可以被“300”秒代替,“1d”(天)可以被“86400”秒代替。“1k”代表“1024”bytes。

3.3 运算符

触发器支持的运算符(在执行中优先级递减)

优先级 运算符 定义 未知值的注释
1 Unary minus Unknown → Unknown
2 not 逻辑非(NOT) not Unknown → Unknown
3 * * Unknown → Unknown
(yes, Unknown, not 0 – to not lose
Unknown in arithmetic operations)
1.2 * Unknown → Unknown
/ 相除 Unknown / 0 → error
Unknown / 1.2 → Unknown
0.0 / Unknown → Unknown
4 + 相加 1.2 + Unknown → Unknown
相减 1.2  Unknown → Unknown
5 < 小于. 该运算符定义:
A<B ⇔ (A<=B-0.000001)
1.2 < Unknown → Unknown
<= 小于等于. Unknown <= Unknown → Unknown
> 大于. 该运算符定义:
A>B ⇔ (A>=B+0.000001)
>= 大于等于.
6 = 相等. 该运算符定义:
A=B ⇔ (A>B-0.000001) and (A<B+0.000001)
<> 不等于. 该运算符定义:
A<>B ⇔ (A<=B-0.000001) or (A>=B+0.000001)
7 and 逻辑与(AND) and Unknown → 0
and Unknown → Unknown
Unknown and Unknown → Unknown
8 or 逻辑或(OR) or Unknown → 1
or Unknown → Unknown
Unknown or Unknown → Unknown

notand and or 运算符区分大小写,而且必须为小写。它们也必须被空格或括号包围。

所有运算符中,除了unary  and not,都有从左到右的关联性。Unary  and not All operators, except unary  and not, have left-to-right associativity. Unary  and not are non-associative (meaning -(-1) and not (not 1) should be used instead of –1 and not not 1).

计算结果:

  • <<=>>==<> 如果指定的关系为真(ture),则运算符将会在触发器表达式中产生“1”;如果指定的关系为假(false),则返回“0”。如果一个运算对象为“Unknown”,那么结果为Unknown;
  • and 对于已知的运算对象,如果两个运算对象的比较不等于“0”,则运算符将会在触发器表达式中产生“1”,否则,它产生“0”;对于未知的运算对象,如果两个运算对象的比较等于“0”,则会产生“0”,否则,则会产生“Unknown”;
  • or 对于已知的运算对象,如果其中任意一个运算对象的比较不等于“0”,则运算符会在触发器表达式中产生“1”,否则,它产生“0”;对于未知的运算对象进行“or”运算,则只有当一个运算对象的比较不等于“0”,才会产生“1”,否则,它会产生“Unknown”;
  • 如果运算单位的值不等于“0”,那么逻辑否定运算符not对于已知运算对象的结果为“0”;
  • The result of the logical negation operator not for a known operand is ‘0’ if the value of its operand compares unequal to ‘0’; ‘1’ if the value of its operand compares equal to ‘0’. For unknown operand not yields ‘Unknown’.

3.4 触发器示例

示例 1

触发器名称:Processor load is too high on www.zabbix.com。触发器表达式如下:

{www.zabbix.com:system.cpu.load[all,avg1].last()}>5

“www.zabbix.com:system.cpu.load[all,avg1]” 给出了被监控对象参数的简短名称。它指定了服务器是“www.zabbix.com”,监控项的键值是“system.cpu.load[all,avg1]”。通过使用函数“last()”获取最近一次获取的值。最后,“>5”表示来自主机www.zabbix.com的最后一次获取的负载值大于5时触发器就会进入PROBLEM状态。

示例 2

触发器名称:www.zabbix.com is overloaded。触发器表达式如下:

{www.zabbix.com:system.cpu.load[all,avg1].last()}>5 or {www.zabbix.com:system.cpu.load[all,avg1].min(10m)}>2

当负载大于5或者最近10分钟内负载大于2,表达式为“TURE”,就会使触发器进入PROBLEM状态。

示例 3

触发器名称:/etc/passwd has been changed。触发器表达式如下:

使用了函数“diff“:

{www.zabbix.com:vfs.file.cksum[/etc/passwd].diff()}=1

当文件/etc/passwd检查的checksum值与最近的值不同时,表达式为“TURE”,就会使触发器进入PROBLEM状态。 同样的表达式还可以用于监控重要的文件,比如文件/etc/passwd、/etc/inetd.conf、/kernel等等。

示例 4

触发器名称:Someone is downloading a large file from the Internet。触发器表达式如下:

使用函数“min”:

{www.zabbix.com:net.if.in[eth0,bytes].min(5m)}>100K

当网络适配器“eth0”在5分钟内接收的字节大于100KB,表达式为“TURE”,就会使触发器进入PROBLEM状态。

示例 5

触发器名称:Both nodes of clustered SMTP server are down。触发器表达式如下:

注意:在同一个表达式中使用了两个不同的主机

{smtp1.zabbix.com:net.tcp.service[smtp].last()}=0 and {smtp2.zabbix.com:net.tcp.service[smtp].last()}=0

当SMTP服务器“smtp1.zabbix.com”和“smtp2.zabbix.com”都停止,表达式为“TURE”,就会使触发器进入PROBLEM状态。

示例 6

触发器名称:Zabbix agent needs to be upgraded。触发器表达式如下:

使用函数“str()”:

{zabbix.zabbix.com:agent.version.str("beta8")}=1

如果Zabbix agent有beta8版本(大概为1.0beta8),表达式为“TURE”,就会使触发器进入PROBLEM状态。

示例 7

触发器名称:Server is unreachable。触发器表达式如下:

{zabbix.zabbix.com:icmpping.count(30m,0)}>5

当主机“zabbix.zabbix.com”在30分钟内超过5次不可达,表达式为“TURE”,就会使触发器进入PROBLEM状态。

示例 8

触发器名称:No heartbeats within last 3 minutes。触发器表达式如下:

使用函数“nodata()”:

{zabbix.zabbix.com:tick.nodata(3m)}=1

‘tick’必须为’Zabbix trapper’类型。为了使这个触发器工作,监控项’tick’必须要定义,这个主机应使用zabbix_sender定期发送此参数的数据,如果在180秒内还未收到zabbix_sender发送的数据,那么触发器的状态就会变成PROBLEM。

示例9

CPU activity at night time 触发器的名称为:CPU activity at night time

使用了函数time():

{zabbix:system.cpu.load[all,avg1].min(5m)}>2 and {zabbix:system.cpu.load[all,avg1].time()}>000000 and {zabbix:system.cpu.load[all,avg1].time()}<060000

只有在凌晨0点到6点整,最后5分钟内cpu load大于2,触发器的状态才会变更为PROBLEM。

示例 10

触发器名称:Check if client local time is in sync with Zabbix server time 使用了函数fuzzytime():

{MySQL_DB:system.localtime.fuzzytime(10)}=0

当MySQL_DB的本地时间与Zabbix server之间的时间相差10秒以上,就会使触发的状态变更为PROBLEM。

示例 11

触发器名称为:Comparing average load today with average load of the same time yesterday (using a second time_shift parameter).

{server:system.cpu.load.avg(1h)}/{server:system.cpu.load.avg(1h,1d)}>2

This expression will fire if the average load of the last hour tops the average load of the same hour yesterday more than two times. 如果最后一小时的平均cpu load超过前一天的同一小时两倍,就会使触发器的状态变更为PROBLEM。

示例 12

使用了另一个监控项来获得触发器的阈值:

{Template PfSense:hrStorageFree[{#SNMPVALUE}].last()}<{Template PfSense:hrStorageSize[{#SNMPVALUE}].last()}*0.1

如果hrStorageFree低于10%,就会使触发器的状态变更为PROBLEM。

示例 13

使用 evaluation result 来获取触发器的数量超过阈值。

({server1:system.cpu.load[all,avg1].last()}>5) + ({server2:system.cpu.load[all,avg1].last()}>5) + ({server3:system.cpu.load[all,avg1].last()}>5)>=2

如果表达式中的两个触发器表达式的结果大于5,就会使触发器的状态变更为PROBLEM。

3.5 滞后(Hysteresis)

Sometimes we need an interval between an OK and Problem states, rather than a simple threshold. For example, we would like to define a trigger which becomes Problem when server room temperature goes above 20C and we want it to stay in that state until the temperature drops below 15C. 有时候我们需要一个触发器状态OK和PROBLEM之间的间隔,而不是简单的阈值。例如,我们想定义一个触发器,当机房的室温超过20摄氏度时,我们希望它保持这个状态,直至温度低于15摄氏度,触发器的状态才会变更为OK。

In order to do this, we first define the trigger expression for the problem event. Then select ‘Recovery expression’ for OK event generation and enter another expression for the OK event. 为了做到这一点,我们首先定义一个PROBLEM事件的触发器表达式,然后为OK event generation选择’Recovery expression’,并为OK事件输入不同的表达式。

示例 1

触发器名称:Temperature in server room is too high.

Problem expression:

{server:temp.last()}>20

Recovery expression:

{server:temp.last()}<=15
示例 2

触发器名称:Free disk space is too low.

Problem expression: 在最近5分钟内文件系统/的空闲空间小于10GB。

{server:vfs.fs.size[/,free].max(5m)}<10G

Recovery expression: 在最近10分钟内文件系统/的空闲空间大于40GB。

{server:vfs.fs.size[/,free].min(10m)}>40G

3.6 具有不受支持的监控项和未知值的表达式

Versions before Zabbix 3.2 are very strict about unsupported items in a trigger expression. Any unsupported item in the expression immediately renders trigger value to Unknown. Zabbix3.2之前的版本对关于触发器表达式中的不受支持的监控项非常严格。表达式中任何不受支持的监控项都将触发器值立即显示为Unknown

Since Zabbix 3.2 there is a more flexible approach to unsupported items by admitting unknown values into expression evaluation: 从Zabbix3.2开始对于不受支持的监控项,通过将它们引入到表达式评估中,产生了一种更加灵活的表达方式:

  • For some functions their values are not affected by whether an item is supported or unsupported. Such functions are now evaluated even if they refer to unsupported items. See the list in functions and unsupported items.
  • 对于一些函数,它们的值不受监控项是否支持与不支持的影响,即使她们引用了不支持的监控项,也会对这些函数进行评估。关于这些函数,请参阅functions and unsupported items
  • Logical expressions with OR and AND can be evaluated to known values in two cases regardless of unknown operands:
  • 具有OR和AND的逻辑表达式可以在两种情况下评估为已知值,不用管未知的运算对象:
    • “1 or Unsuported_item1.some_function() or Unsuported_item2.some_function() or …” can be evaluated to ‘1’ (True),
    • “1 or Unsuported_item1.some_function() or Unsuported_item2.some_function() or …“可以被评估为’1′ (True),
    • “0 and Unsuported_item1.some_function() and Unsuported_item2.some_function() and …” can be evaluated to ‘0’ (False).
      Zabbix tries to evaluate logical expressions taking unsupported items as Unknown values. In the two cases mentioned above a known value will be produced; in other cases trigger value will be Unknown.
    • “0 and Unsuported_item1.some_function() and Unsuported_item2.some_function() and …“可以被评估为’0′ (False).\\Zabbix尝试评估将将不受支持的监控项作为Unknown值的逻辑表达式。在上述两种情况下,将产生一个Known值;在其他情况下,触发器将产生Unknown值。
  • If a function evaluation for supported item results in error, the function value is Unknown and it takes part in further expression evaluation.
  • 如果对受支持的监控项的一个函数评估结果为错误,那么这个函数的值为Unknown ,并且它将参与进一步的表达式评估。

Note that unknown values may “disappear” only in logical expressions as described above. In arithmetic expressions unknown values always lead to result Unknown (except division by 0). 备注:未知值只会在上述逻辑表达式中“消失”。在算数表达式中未知值总会导致结果为Unknown(除以0除外)。

If a trigger expression with several unsupported items evaluates to Unknown the error message in the frontend refers to the last unsupported item evaluated. 如果具有多个不受支持的监控项的触发器表达式评估为Unknown,那么在前端中的错误消息值的是最后一个不受支持的项目。

https://www.zabbix.com/documentation/3.4/zh/manual/config/triggers/expression 

zabbix监控netscaler9/10模板

zabbix监控Netscaler采用snmp方式,所以需要在监控主机中定义宏{$SNMP_COMMUNITY}

模板如下:

<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
    <version>2.0</version>
    <date>2016-04-21T08:37:25Z</date>
    <groups>
        <group>
            <name>Templates</name>
        </group>
    </groups>
    <templates>
        <template>
            <template>Template_NetScaler_9</template>
            <name>Template_NetScaler_9</name>
            <description/>
            <groups>
                <group>
                    <name>Templates</name>
                </group>
            </groups>
            <applications>
                <application>
                    <name>NetScaler_interfaces</name>
                </application>
                <application>
                    <name>NetScaler_main</name>
                </application>
                <application>
                    <name>NetScaler_services</name>
                </application>
                <application>
                    <name>NetScaler_vservers</name>
                </application>
            </applications>
            <items>
                <item>
                    <name>haPeerState</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.23.3.0</snmp_oid>
                    <key>haPeerState.ns</key>
                    <delay>600</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>httpTot11Requests</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.48.68.0</snmp_oid>
                    <key>httpTot11Requests</key>
                    <delay>60</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>1</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>httpTot11Responses</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.48.69.0</snmp_oid>
                    <key>httpTot11Responses</key>
                    <delay>60</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>1</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>httpTotRequests</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.48.67.0</snmp_oid>
                    <key>httpTotRequests</key>
                    <delay>60</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>1</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>memSizeMB</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.41.4.0</snmp_oid>
                    <key>memSizeMB</key>
                    <delay>3600</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units>Mb</units>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>numCPUs</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.41.3.0</snmp_oid>
                    <key>numCPUs</key>
                    <delay>3600</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>resCpuUsage</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.41.1.0</snmp_oid>
                    <key>resCpuUsage</key>
                    <delay>60</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units>%</units>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>resMemUsage</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.41.2.0</snmp_oid>
                    <key>resMemUsage.ns</key>
                    <delay>60</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units>%</units>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>tcpActiveServerConn</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.46.8.0</snmp_oid>
                    <key>tcpActiveServerConn</key>
                    <delay>60</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>tcpCurClientConn</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.46.2.0</snmp_oid>
                    <key>tcpCurClientConn.ns</key>
                    <delay>60</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>tcpCurServerConn</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>0</multiplier>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.46.1.0</snmp_oid>
                    <key>tcpCurServerConn.ns</key>
                    <delay>60</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>UpTime</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <multiplier>1</multiplier>
                    <snmp_oid>.1.3.6.1.2.1.1.3.0</snmp_oid>
                    <key>sysUpTime</key>
                    <delay>600</delay>
                    <history>60</history>
                    <trends>180</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units>uptime</units>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>0.01</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NetScaler_main</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
            </items>
            <discovery_rules>
                <discovery_rule>
                    <name>Interfaces</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.54.1.1</snmp_oid>
                    <key>snmp.interfaces.discovery</key>
                    <delay>60</delay>
                    <status>0</status>
                    <allowed_hosts/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port>161</port>
                    <filter>
                        <evaltype>0</evaltype>
                        <formula/>
                        <conditions/>
                    </filter>
                    <lifetime>30</lifetime>
                    <description/>
                    <item_prototypes>
                        <item_prototype>
                            <name>Interface {#SNMPVALUE} received bits</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.54.1.19.{#SNMPINDEX}</snmp_oid>
                            <key>r_bits.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>Mbps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_interfaces</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Interface {#SNMPVALUE} received bytes</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.54.1.3.{#SNMPINDEX}</snmp_oid>
                            <key>r_bytes.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>bps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_interfaces</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Interface {#SNMPVALUE} received packets</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.54.1.5.{#SNMPINDEX}</snmp_oid>
                            <key>r_pks.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>1</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>pps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_interfaces</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Interface {#SNMPVALUE} transmitted bits</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.54.1.20.{#SNMPINDEX}</snmp_oid>
                            <key>t_bits.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>Mbps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_interfaces</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Interface {#SNMPVALUE} transmitted bytes</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.54.1.7.{#SNMPINDEX}</snmp_oid>
                            <key>t_bytes.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>bps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_interfaces</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Interface {#SNMPVALUE} transmitted packets</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.54.1.9.{#SNMPINDEX}</snmp_oid>
                            <key>t_pks.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>1</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>pps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_interfaces</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Interface {#SNMPVALUE} type</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.1.54.1.2.{#SNMPINDEX}</snmp_oid>
                            <key>type.[{#SNMPVALUE}]</key>
                            <delay>3600</delay>
                            <history>30</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>1</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_interfaces</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes/>
                    <graph_prototypes>
                        <graph_prototype>
                            <name>Interface {#SNMPVALUE} bits</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>0000C8</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>r_bits.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>C800C8</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>t_bits.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                        <graph_prototype>
                            <name>Interface {#SNMPVALUE} bytes</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>1</drawtype>
                                    <color>00CC00</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>r_bytes.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>2</drawtype>
                                    <color>0000CC</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>t_bytes.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                        <graph_prototype>
                            <name>Interface {#SNMPVALUE} packets</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>1</drawtype>
                                    <color>00CC00</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>r_pks.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>2</drawtype>
                                    <color>0000CC</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>t_pks.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                    </graph_prototypes>
                    <host_prototypes/>
                </discovery_rule>
                <discovery_rule>
                    <name>Services</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.1</snmp_oid>
                    <key>snmp.services.discovery</key>
                    <delay>60</delay>
                    <status>0</status>
                    <allowed_hosts/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port>161</port>
                    <filter>
                        <evaltype>0</evaltype>
                        <formula/>
                        <conditions/>
                    </filter>
                    <lifetime>30</lifetime>
                    <description/>
                    <item_prototypes>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} Act conn</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.9.{#SNMPINDEX}</snmp_oid>
                            <key>service.actconn.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} Est conn</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.8.{#SNMPINDEX}</snmp_oid>
                            <key>service.estconn.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} IP</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.2.{#SNMPINDEX}</snmp_oid>
                            <key>service.ip.[{#SNMPVALUE}]</key>
                            <delay>3600</delay>
                            <history>30</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>1</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} port</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.3.{#SNMPINDEX}</snmp_oid>
                            <key>service.port.[{#SNMPVALUE}]</key>
                            <delay>3600</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} Total recvd pkts</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.34.{#SNMPINDEX}</snmp_oid>
                            <key>service.totresvdpkts.[{#SNMPVALUE}]</key>
                            <delay>120</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>1</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>pps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} Total req</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.30.{#SNMPINDEX}</snmp_oid>
                            <key>service.totreq.[{#SNMPVALUE}]</key>
                            <delay>120</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} Total req bytes</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.31.{#SNMPINDEX}</snmp_oid>
                            <key>service.totreqb.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>bps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} Total resp</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.32.{#SNMPINDEX}</snmp_oid>
                            <key>service.totresp.[{#SNMPVALUE}]</key>
                            <delay>120</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} Total resp bytes</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.33.{#SNMPINDEX}</snmp_oid>
                            <key>service.totrespb.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>bps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Service {#SNMPVALUE} Total sent pkts</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.2.1.1.35.{#SNMPINDEX}</snmp_oid>
                            <key>service.totrsentpkts.[{#SNMPVALUE}]</key>
                            <delay>120</delay>
                            <history>30</history>
                            <trends>180</trends>
                            <status>1</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>pps</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_services</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes/>
                    <graph_prototypes>
                        <graph_prototype>
                            <name>Service {#SNMPVALUE} bytes</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>1</drawtype>
                                    <color>00CC00</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>service.totreqb.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>2</drawtype>
                                    <color>0000BB</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>service.totrespb.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                        <graph_prototype>
                            <name>Service {#SNMPVALUE} packets</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>1</drawtype>
                                    <color>00BB00</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>service.totresvdpkts.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>2</drawtype>
                                    <color>0000BB</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>service.totrsentpkts.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                        <graph_prototype>
                            <name>Service {#SNMPVALUE} Requests - Responses</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>00BB00</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>service.totreq.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>0000CC</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>service.totresp.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                    </graph_prototypes>
                    <host_prototypes/>
                </discovery_rule>
                <discovery_rule>
                    <name>Vservers</name>
                    <type>4</type>
                    <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                    <snmp_oid>.1.3.6.1.4.1.5951.4.1.3.1.1.1</snmp_oid>
                    <key>snmp.vservers.discovery</key>
                    <delay>60</delay>
                    <status>0</status>
                    <allowed_hosts/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port>161</port>
                    <filter>
                        <evaltype>0</evaltype>
                        <formula/>
                        <conditions/>
                    </filter>
                    <lifetime>30</lifetime>
                    <description/>
                    <item_prototypes>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE}</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.3.1.1.1.{#SNMPINDEX}</snmp_oid>
                            <key>name.[{#SNMPVALUE}]</key>
                            <delay>3600</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>1</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} Client Conn</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.3.1.1.7.{#SNMPINDEX}</snmp_oid>
                            <key>cl_conn.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} IP</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.3.1.1.2.{#SNMPINDEX}</snmp_oid>
                            <key>ip.[{#SNMPVALUE}]</key>
                            <delay>3600</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>1</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} port</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.3.1.1.3.{#SNMPINDEX}</snmp_oid>
                            <key>port.[{#SNMPVALUE}]</key>
                            <delay>3600</delay>
                            <history>90</history>
                            <trends>180</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} Server Conn</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.3.1.1.8.{#SNMPINDEX}</snmp_oid>
                            <key>sr_conn.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} Total Requests</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.3.1.1.30.{#SNMPINDEX}</snmp_oid>
                            <key>req_tot.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} Total Respones</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>.1.3.6.1.4.1.5951.4.1.3.1.1.32.{#SNMPINDEX}</snmp_oid>
                            <key>res_tot.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} vsvrHealth</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>1.3.6.1.4.1.5951.4.1.3.1.1.62.{#SNMPINDEX}</snmp_oid>
                            <key>vsvr_Health.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>1</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>%</units>
                            <delta>0</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} vsvrRequestRate</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>1.3.6.1.4.1.5951.4.1.3.1.1.43.{#SNMPINDEX}</snmp_oid>
                            <key>vsvrRequest_Rate.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units/>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} vsvrRxBytesRate</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>1.3.6.1.4.1.5951.4.1.3.1.1.44.{#SNMPINDEX}</snmp_oid>
                            <key>vsvrRxBytesRate.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>B/s</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} vsvrTotalRequestBytes</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>1.3.6.1.4.1.5951.4.1.3.1.1.31.{#SNMPINDEX}</snmp_oid>
                            <key>vsvrTotalRequestBytes.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>B/s</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} vsvrTotalResponseBytes</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>1.3.6.1.4.1.5951.4.1.3.1.1.33.{#SNMPINDEX}</snmp_oid>
                            <key>vsvrTotalResponseBytes.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>B/s</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                        <item_prototype>
                            <name>Vserver {#SNMPVALUE} vsvrTxBytesRate</name>
                            <type>4</type>
                            <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                            <multiplier>0</multiplier>
                            <snmp_oid>1.3.6.1.4.1.5951.4.1.3.1.1.45.{#SNMPINDEX}</snmp_oid>
                            <key>vsvrTxBytesRate.[{#SNMPVALUE}]</key>
                            <delay>60</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>B/s</units>
                            <delta>1</delta>
                            <snmpv3_contextname/>
                            <snmpv3_securityname/>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authprotocol>0</snmpv3_authprotocol>
                            <snmpv3_authpassphrase/>
                            <snmpv3_privprotocol>0</snmpv3_privprotocol>
                            <snmpv3_privpassphrase/>
                            <formula>1</formula>
                            <delay_flex/>
                            <params/>
                            <ipmi_sensor/>
                            <data_type>0</data_type>
                            <authtype>0</authtype>
                            <username/>
                            <password/>
                            <publickey/>
                            <privatekey/>
                            <port/>
                            <description/>
                            <inventory_link>0</inventory_link>
                            <applications>
                                <application>
                                    <name>NetScaler_vservers</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes/>
                    <graph_prototypes>
                        <graph_prototype>
                            <name>Vserver {#SNMPVALUE} requests and responses</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>C80000</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>req_tot.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>00C800</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>cl_conn.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>2</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>0000C8</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>sr_conn.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>3</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>FFFF33</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>res_tot.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                        <graph_prototype>
                            <name>Vserver {#SNMPVALUE} requests and responses Bytes</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>00C8C8</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>vsvrTotalRequestBytes.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>C8C800</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>vsvrTotalResponseBytes.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                        <graph_prototype>
                            <name>Vserver {#SNMPVALUE} vsvr Tx  Rx Bytes Rate</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>0000C8</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>vsvrRxBytesRate.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>C800C8</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>vsvrTxBytesRate.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                        <graph_prototype>
                            <name>vsvrHealth {#SNMPVALUE} 百分比</name>
                            <width>900</width>
                            <height>200</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>100.0000</yaxismax>
                            <show_work_period>1</show_work_period>
                            <show_triggers>1</show_triggers>
                            <type>0</type>
                            <show_legend>1</show_legend>
                            <show_3d>0</show_3d>
                            <percent_left>0.0000</percent_left>
                            <percent_right>0.0000</percent_right>
                            <ymin_type_1>0</ymin_type_1>
                            <ymax_type_1>0</ymax_type_1>
                            <ymin_item_1>0</ymin_item_1>
                            <ymax_item_1>0</ymax_item_1>
                            <graph_items>
                                <graph_item>
                                    <sortorder>0</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>00C800</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Template_NetScaler_9</host>
                                        <key>vsvr_Health.[{#SNMPVALUE}]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                    </graph_prototypes>
                    <host_prototypes/>
                </discovery_rule>
            </discovery_rules>
            <macros>
                <macro>
                    <macro>{$SNMP_COMMUNITY}</macro>
                    <value>public</value>
                </macro>
            </macros>
            <templates/>
            <screens/>
        </template>
    </templates>
    <triggers>
        <trigger>
            <expression>{Template_NetScaler_9:sysUpTime.change(0)}&lt;0</expression>
            <name>{HOST.NAME} has just been restarted</name>
            <url/>
            <status>0</status>
            <priority>4</priority>
            <description/>
            <type>0</type>
            <dependencies/>
        </trigger>
    </triggers>
    <graphs>
        <graph>
            <name>NetScaler Connection</name>
            <width>900</width>
            <height>200</height>
            <yaxismin>0.0000</yaxismin>
            <yaxismax>100.0000</yaxismax>
            <show_work_period>1</show_work_period>
            <show_triggers>1</show_triggers>
            <type>0</type>
            <show_legend>1</show_legend>
            <show_3d>0</show_3d>
            <percent_left>0.0000</percent_left>
            <percent_right>0.0000</percent_right>
            <ymin_type_1>0</ymin_type_1>
            <ymax_type_1>0</ymax_type_1>
            <ymin_item_1>0</ymin_item_1>
            <ymax_item_1>0</ymax_item_1>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <drawtype>0</drawtype>
                    <color>C80000</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template_NetScaler_9</host>
                        <key>tcpActiveServerConn</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>1</sortorder>
                    <drawtype>0</drawtype>
                    <color>00C800</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template_NetScaler_9</host>
                        <key>tcpCurClientConn.ns</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>2</sortorder>
                    <drawtype>0</drawtype>
                    <color>0000C8</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template_NetScaler_9</host>
                        <key>tcpCurServerConn.ns</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>NetScaler CPU Usage</name>
            <width>900</width>
            <height>200</height>
            <yaxismin>0.0000</yaxismin>
            <yaxismax>100.0000</yaxismax>
            <show_work_period>1</show_work_period>
            <show_triggers>1</show_triggers>
            <type>1</type>
            <show_legend>1</show_legend>
            <show_3d>0</show_3d>
            <percent_left>0.0000</percent_left>
            <percent_right>0.0000</percent_right>
            <ymin_type_1>0</ymin_type_1>
            <ymax_type_1>0</ymax_type_1>
            <ymin_item_1>0</ymin_item_1>
            <ymax_item_1>0</ymax_item_1>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <drawtype>0</drawtype>
                    <color>00C800</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template_NetScaler_9</host>
                        <key>resCpuUsage</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>NetScaler Memory Usage</name>
            <width>900</width>
            <height>200</height>
            <yaxismin>0.0000</yaxismin>
            <yaxismax>100.0000</yaxismax>
            <show_work_period>1</show_work_period>
            <show_triggers>1</show_triggers>
            <type>1</type>
            <show_legend>1</show_legend>
            <show_3d>0</show_3d>
            <percent_left>0.0000</percent_left>
            <percent_right>0.0000</percent_right>
            <ymin_type_1>0</ymin_type_1>
            <ymax_type_1>0</ymax_type_1>
            <ymin_item_1>0</ymin_item_1>
            <ymax_item_1>0</ymax_item_1>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <drawtype>0</drawtype>
                    <color>00BB00</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template_NetScaler_9</host>
                        <key>resMemUsage.ns</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>NetScaler Requests</name>
            <width>900</width>
            <height>200</height>
            <yaxismin>0.0000</yaxismin>
            <yaxismax>100.0000</yaxismax>
            <show_work_period>1</show_work_period>
            <show_triggers>1</show_triggers>
            <type>0</type>
            <show_legend>1</show_legend>
            <show_3d>0</show_3d>
            <percent_left>0.0000</percent_left>
            <percent_right>0.0000</percent_right>
            <ymin_type_1>0</ymin_type_1>
            <ymax_type_1>0</ymax_type_1>
            <ymin_item_1>0</ymin_item_1>
            <ymax_item_1>0</ymax_item_1>
            <graph_items>
                <graph_item>
                    <sortorder>1</sortorder>
                    <drawtype>0</drawtype>
                    <color>0000CC</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template_NetScaler_9</host>
                        <key>httpTot11Requests</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>2</sortorder>
                    <drawtype>0</drawtype>
                    <color>00C800</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template_NetScaler_9</host>
                        <key>httpTot11Responses</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>0</sortorder>
                    <drawtype>2</drawtype>
                    <color>CC0000</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template_NetScaler_9</host>
                        <key>httpTotRequests</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
    </graphs>
</zabbix_export>

Zabbix监控ntp时间

zabbix监控时间服务

[root@localhost htdocs]# cd /etc/zabbix/
[root@localhost zabbix]# ls
scripts  zabbix_agentd.conf  zabbix_agentd.conf.bak  zabbix_agentd.conf.rpmnew  zabbix_agentd.d
[root@localhost zabbix]# cd scripts/
[root@localhost scripts]# ls
ntpcheck.sh
[root@localhost scripts]# cat ntpcheck.sh 
#!/bin/bash
VERSION="1.0"
function usage()
{
        echo "ntpcheck version: $VERSION"
        echo "usage:"
        echo " $0 jitter - Check ntp jitter delay"
        echo " $0 offset - Check ntp offset"
        echo " $0 delay - Check ntp delay"
} ########
# Main #
########
if [[ $# != 1 ]];then
        #No Parameter
        usage
        exit 0
fi

case "$1" in
'jitter')
        value=`ntpq -pn 127.0.0.1 | /usr/bin/awk 'BEGIN { jitter=0 } $1 ~/\*/ { jitter=$10 } END { print jitter }'`
        rval=$?;;
'offset')
        value=`ntpq -pn 127.0.0.1 | /usr/bin/awk 'BEGIN { offset=0 } $1 ~/\*/ { offset=$9 } END { print offset }'`
        rval=$?;;
'delay')
        value=`ntpq -pn 127.0.0.1 | /usr/bin/awk 'BEGIN { delay=0 } $1 ~/\*/ { delay=$8 } END { print delay }'`
        rval=$?;;
*)
        usage
        exit 1;;
esac
if [ "$rval" -eq 0 -a -z "$value" ]; then
        rval=1
fi

if [ "$rval" -ne 0 ]; then
        echo "ZBX_NOTSUPPORTED"
fi

echo $value

[root@localhost scripts]# cd ../
[root@localhost zabbix]# ls
scripts  zabbix_agentd.conf  zabbix_agentd.conf.bak  zabbix_agentd.conf.rpmnew  zabbix_agentd.d
[root@localhost zabbix]# cd zabbix_agentd.d/
[root@localhost zabbix_agentd.d]# ls
userparameter_mysql.conf userparameter_ntpd.conf
[root@localhost zabbix_agentd.d]# cat userparameter_ntpd.conf 
UserParameter=ntp[*],/etc/zabbix/scripts/ntpcheck.sh $1
[root@localhost zabbix_agentd.d]#

ntp模板


<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
    <version>3.0</version>
    <date>2016-07-01T08:53:17Z</date>
    <groups>
        <group>
            <name>Templates</name>
        </group>
    </groups>
    <templates>
        <template>
            <template>Template App NTP Service</template>
            <name>Template App NTP Service</name>
            <description/>
            <groups>
                <group>
                    <name>Templates</name>
                </group>
            </groups>
            <applications>
                <application>
                    <name>NTP service</name>
                </application>
            </applications>
            <items>
                <item>
                    <name>NTP RUN</name>
                    <type>0</type>
                    <snmp_community/>
                    <multiplier>0</multiplier>
                    <snmp_oid/>
                    <key>net.udp.listen[123]</key>
                    <delay>30</delay>
                    <history>90</history>
                    <trends>365</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NTP service</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>NTP service is running</name>
                    <type>3</type>
                    <snmp_community/>
                    <multiplier>0</multiplier>
                    <snmp_oid/>
                    <key>net.udp.service[ntp]</key>
                    <delay>60</delay>
                    <history>7</history>
                    <trends>365</trends>
                    <status>1</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NTP service</name>
                        </application>
                    </applications>
                    <valuemap>
                        <name>Service state</name>
                    </valuemap>
                    <logtimefmt/>
                </item>
                <item>
                    <name>NTP-delay</name>
                    <type>0</type>
                    <snmp_community/>
                    <multiplier>0</multiplier>
                    <snmp_oid/>
                    <key>ntp[delay]</key>
                    <delay>30</delay>
                    <history>90</history>
                    <trends>365</trends>
                    <status>0</status>
                    <value_type>0</value_type>
                    <allowed_hosts/>
                    <units>ms</units>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NTP service</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>NTP-jitter</name>
                    <type>0</type>
                    <snmp_community/>
                    <multiplier>0</multiplier>
                    <snmp_oid/>
                    <key>ntp[jitter]</key>
                    <delay>30</delay>
                    <history>90</history>
                    <trends>365</trends>
                    <status>0</status>
                    <value_type>0</value_type>
                    <allowed_hosts/>
                    <units>ms</units>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NTP service</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
                <item>
                    <name>NTP-offset</name>
                    <type>0</type>
                    <snmp_community/>
                    <multiplier>0</multiplier>
                    <snmp_oid/>
                    <key>ntp[offset]</key>
                    <delay>30</delay>
                    <history>90</history>
                    <trends>365</trends>
                    <status>0</status>
                    <value_type>0</value_type>
                    <allowed_hosts/>
                    <units>ms</units>
                    <delta>0</delta>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <formula>1</formula>
                    <delay_flex/>
                    <params/>
                    <ipmi_sensor/>
                    <data_type>0</data_type>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>NTP service</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                </item>
            </items>
            <discovery_rules/>
            <macros/>
            <templates/>
            <screens/>
        </template>
    </templates>
    <triggers>
        <trigger>
            <expression>{Template App NTP Service:net.udp.listen[123].max(#3)}=0</expression>
            <name>NTP service is down on {HOST.NAME}</name>
            <url/>
            <status>0</status>
            <priority>3</priority>
            <description/>
            <type>0</type>
            <dependencies/>
        </trigger>
        <trigger>
            <expression>{Template App NTP Service:ntp[offset].last(30)}&gt;10</expression>
            <name>时钟误差10毫秒 {HOST.NAME}</name>
            <url/>
            <status>0</status>
            <priority>3</priority>
            <description/>
            <type>0</type>
            <dependencies/>
        </trigger>
    </triggers>
    <graphs>
        <graph>
            <name>NTP-Detail</name>
            <width>900</width>
            <height>200</height>
            <yaxismin>0.0000</yaxismin>
            <yaxismax>100.0000</yaxismax>
            <show_work_period>1</show_work_period>
            <show_triggers>1</show_triggers>
            <type>0</type>
            <show_legend>1</show_legend>
            <show_3d>0</show_3d>
            <percent_left>0.0000</percent_left>
            <percent_right>0.0000</percent_right>
            <ymin_type_1>0</ymin_type_1>
            <ymax_type_1>0</ymax_type_1>
            <ymin_item_1>0</ymin_item_1>
            <ymax_item_1>0</ymax_item_1>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <drawtype>0</drawtype>
                    <color>00C800</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template App NTP Service</host>
                        <key>ntp[delay]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>1</sortorder>
                    <drawtype>0</drawtype>
                    <color>C80000</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template App NTP Service</host>
                        <key>ntp[jitter]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>2</sortorder>
                    <drawtype>0</drawtype>
                    <color>0000C8</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>2</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template App NTP Service</host>
                        <key>ntp[offset]</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
    </graphs>
    <value_maps>
        <value_map>
            <name>Service state</name>
            <mappings>
                <mapping>
                    <value>0</value>
                    <newvalue>Down</newvalue>
                </mapping>
                <mapping>
                    <value>1</value>
                    <newvalue>Up</newvalue>
                </mapping>
            </mappings>
        </value_map>
    </value_maps>
</zabbix_export>


Zabbix数据库表分区优化

按照官方的方法执行,请浏览页面https://www.zabbix.org/wiki/Docs/howto/mysql_partition

为了快速操作,我将原有数据清空了(清空表操作);

mysql> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> truncate table history;
Query OK, 0 rows affected (0.82 sec)

mysql> optimize  table history;
+----------------+----------+----------+-------------------------------------------------------------------+
| Table          | Op       | Msg_type | Msg_text                                                          |
+----------------+----------+----------+-------------------------------------------------------------------+
| zabbix.history | optimize | note     | Table does not support optimize, doing recreate + analyze instead |
| zabbix.history | optimize | status   | OK                                                                |
+----------------+----------+----------+-------------------------------------------------------------------+
2 rows in set (0.30 sec)

mysql> truncate table history_str;
Query OK, 0 rows affected (0.25 sec)

mysql> truncate table history_uint;
Query OK, 0 rows affected (1.48 sec)

mysql> Alter table history_text drop primary key, add index (id), drop index history_text_2, add index history_text_2 (itemid, id);
Query OK, 2183087 rows affected (57.73 sec)
Records: 2183087  Duplicates: 0  Warnings: 0

mysql> Alter table history_log drop primary key, add index (id), drop index history_log_2, add index history_log_2 (itemid, id);
Query OK, 0 rows affected (0.93 sec)
Records: 0  Duplicates: 0  Warnings: 0

将官方的四个分散代码拷贝至一个文件保存为sql,导入数据库;

[root@localhost ~]# cat zabbix-partition.sql 
DELIMITER $$
CREATE PROCEDURE `partition_create`(SCHEMANAME varchar(64), TABLENAME varchar(64), PARTITIONNAME varchar(64), CLOCK int)
BEGIN
        /*
           SCHEMANAME = The DB schema in which to make changes
           TABLENAME = The table with partitions to potentially delete
           PARTITIONNAME = The name of the partition to create
        */
        /*
           Verify that the partition does not already exist
        */

        DECLARE RETROWS INT;
        SELECT COUNT(1) INTO RETROWS
        FROM information_schema.partitions
        WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND partition_description >= CLOCK;

        IF RETROWS = 0 THEN
                /*
                   1. Print a message indicating that a partition was created.
                   2. Create the SQL to create the partition.
                   3. Execute the SQL from #2.
                */
                SELECT CONCAT( "partition_create(", SCHEMANAME, ",", TABLENAME, ",", PARTITIONNAME, ",", CLOCK, ")" ) AS msg;
                SET @sql = CONCAT( 'ALTER TABLE ', SCHEMANAME, '.', TABLENAME, ' ADD PARTITION (PARTITION ', PARTITIONNAME, ' VALUES LESS THAN (', CLOCK, '));' );
                PREPARE STMT FROM @sql;
                EXECUTE STMT;
                DEALLOCATE PREPARE STMT;
        END IF;
END$$
DELIMITER ;

DELIMITER $$
CREATE PROCEDURE `partition_drop`(SCHEMANAME VARCHAR(64), TABLENAME VARCHAR(64), DELETE_BELOW_PARTITION_DATE BIGINT)
BEGIN
        /*
           SCHEMANAME = The DB schema in which to make changes
           TABLENAME = The table with partitions to potentially delete
           DELETE_BELOW_PARTITION_DATE = Delete any partitions with names that are dates older than this one (yyyy-mm-dd)
        */
        DECLARE done INT DEFAULT FALSE;
        DECLARE drop_part_name VARCHAR(16);

        /*
           Get a list of all the partitions that are older than the date
           in DELETE_BELOW_PARTITION_DATE.  All partitions are prefixed with
           a "p", so use SUBSTRING TO get rid of that character.
        */
        DECLARE myCursor CURSOR FOR
                SELECT partition_name
                FROM information_schema.partitions
                WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND CAST(SUBSTRING(partition_name FROM 2) AS UNSIGNED) < DELETE_BELOW_PARTITION_DATE;
        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

        /*
           Create the basics for when we need to drop the partition.  Also, create
           @drop_partitions to hold a comma-delimited list of all partitions that
           should be deleted.
        */
        SET @alter_header = CONCAT("ALTER TABLE ", SCHEMANAME, ".", TABLENAME, " DROP PARTITION ");
        SET @drop_partitions = "";

        /*
           Start looping through all the partitions that are too old.
        */
        OPEN myCursor;
        read_loop: LOOP
                FETCH myCursor INTO drop_part_name;
                IF done THEN
                        LEAVE read_loop;
                END IF;
                SET @drop_partitions = IF(@drop_partitions = "", drop_part_name, CONCAT(@drop_partitions, ",", drop_part_name));
        END LOOP;
        IF @drop_partitions != "" THEN
                /*
                   1. Build the SQL to drop all the necessary partitions.
                   2. Run the SQL to drop the partitions.
                   3. Print out the table partitions that were deleted.
                */
                SET @full_sql = CONCAT(@alter_header, @drop_partitions, ";");
                PREPARE STMT FROM @full_sql;
                EXECUTE STMT;
                DEALLOCATE PREPARE STMT;

                SELECT CONCAT(SCHEMANAME, ".", TABLENAME) AS `table`, @drop_partitions AS `partitions_deleted`;
        ELSE
                /*
                   No partitions are being deleted, so print out "N/A" (Not applicable) to indicate
                   that no changes were made.
                */
                SELECT CONCAT(SCHEMANAME, ".", TABLENAME) AS `table`, "N/A" AS `partitions_deleted`;
        END IF;
END$$
DELIMITER ;

DELIMITER $$
CREATE PROCEDURE `partition_maintenance`(SCHEMA_NAME VARCHAR(32), TABLE_NAME VARCHAR(32), KEEP_DATA_DAYS INT, HOURLY_INTERVAL INT, CREATE_NEXT_INTERVALS INT)
BEGIN
        DECLARE OLDER_THAN_PARTITION_DATE VARCHAR(16);
        DECLARE PARTITION_NAME VARCHAR(16);
        DECLARE OLD_PARTITION_NAME VARCHAR(16);
        DECLARE LESS_THAN_TIMESTAMP INT;
        DECLARE CUR_TIME INT;

        CALL partition_verify(SCHEMA_NAME, TABLE_NAME, HOURLY_INTERVAL);
        SET CUR_TIME = UNIX_TIMESTAMP(DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00'));

        SET @__interval = 1;
        create_loop: LOOP
                IF @__interval > CREATE_NEXT_INTERVALS THEN
                        LEAVE create_loop;
                END IF;

                SET LESS_THAN_TIMESTAMP = CUR_TIME + (HOURLY_INTERVAL * @__interval * 3600);
                SET PARTITION_NAME = FROM_UNIXTIME(CUR_TIME + HOURLY_INTERVAL * (@__interval - 1) * 3600, 'p%Y%m%d%H00');
                IF(PARTITION_NAME != OLD_PARTITION_NAME) THEN
      CALL partition_create(SCHEMA_NAME, TABLE_NAME, PARTITION_NAME, LESS_THAN_TIMESTAMP);
    END IF;
                SET @__interval=@__interval+1;
                SET OLD_PARTITION_NAME = PARTITION_NAME;
        END LOOP;

        SET OLDER_THAN_PARTITION_DATE=DATE_FORMAT(DATE_SUB(NOW(), INTERVAL KEEP_DATA_DAYS DAY), '%Y%m%d0000');
        CALL partition_drop(SCHEMA_NAME, TABLE_NAME, OLDER_THAN_PARTITION_DATE);

END$$
DELIMITER ;

DELIMITER $$
CREATE PROCEDURE `partition_verify`(SCHEMANAME VARCHAR(64), TABLENAME VARCHAR(64), HOURLYINTERVAL INT(11))
BEGIN
        DECLARE PARTITION_NAME VARCHAR(16);
        DECLARE RETROWS INT(11);
        DECLARE FUTURE_TIMESTAMP TIMESTAMP;

        /*
         * Check if any partitions exist for the given SCHEMANAME.TABLENAME.
         */
        SELECT COUNT(1) INTO RETROWS
        FROM information_schema.partitions
        WHERE table_schema = SCHEMANAME AND table_name = TABLENAME AND partition_name IS NULL;

        /*
         * If partitions do not exist, go ahead and partition the table
         */
        IF RETROWS = 1 THEN
                /*
                 * Take the current date at 00:00:00 and add HOURLYINTERVAL to it.  This is the timestamp below which we will store values.
                 * We begin partitioning based on the beginning of a day.  This is because we don't want to generate a random partition
                 * that won't necessarily fall in line with the desired partition naming (ie: if the hour interval is 24 hours, we could
                 * end up creating a partition now named "p201403270600" when all other partitions will be like "p201403280000").
                 */
                SET FUTURE_TIMESTAMP = TIMESTAMPADD(HOUR, HOURLYINTERVAL, CONCAT(CURDATE(), " ", '00:00:00'));
                SET PARTITION_NAME = DATE_FORMAT(CURDATE(), 'p%Y%m%d%H00');

                -- Create the partitioning query
                SET @__PARTITION_SQL = CONCAT("ALTER TABLE ", SCHEMANAME, ".", TABLENAME, " PARTITION BY RANGE(`clock`)");
                SET @__PARTITION_SQL = CONCAT(@__PARTITION_SQL, "(PARTITION ", PARTITION_NAME, " VALUES LESS THAN (", UNIX_TIMESTAMP(FUTURE_TIMESTAMP), "));");

                -- Run the partitioning query
                PREPARE STMT FROM @__PARTITION_SQL;
                EXECUTE STMT;
                DEALLOCATE PREPARE STMT;
        END IF;
END$$
DELIMITER ;


[root@localhost ~]# 

##请登录mysql,切换到zabbix的数据库下执行

mysql> source /root/zabbix-partition.sql;
Query OK, 0 rows affected (0.00 sec)
mysql> CALL partition_maintenance('zabbix', 'history_log', 28, 24, 14);
+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607020000,1467475200) |
+---------------------------------------------------------------+
1 row in set (0.69 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607030000,1467561600) |
+---------------------------------------------------------------+
1 row in set (1.94 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607040000,1467648000) |
+---------------------------------------------------------------+
1 row in set (3.48 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607050000,1467734400) |
+---------------------------------------------------------------+
1 row in set (4.22 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607060000,1467820800) |
+---------------------------------------------------------------+
1 row in set (4.94 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607070000,1467907200) |
+---------------------------------------------------------------+
1 row in set (5.70 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607080000,1467993600) |
+---------------------------------------------------------------+
1 row in set (6.49 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607090000,1468080000) |
+---------------------------------------------------------------+
1 row in set (7.23 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607100000,1468166400) |
+---------------------------------------------------------------+
1 row in set (7.91 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607110000,1468252800) |
+---------------------------------------------------------------+
1 row in set (8.71 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607120000,1468339200) |
+---------------------------------------------------------------+
1 row in set (10.26 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607130000,1468425600) |
+---------------------------------------------------------------+
1 row in set (11.52 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_log,p201607140000,1468512000) |
+---------------------------------------------------------------+
1 row in set (12.37 sec)

+--------------------+--------------------+
| table              | partitions_deleted |
+--------------------+--------------------+
| zabbix.history_log | N/A                |
+--------------------+--------------------+
1 row in set (13.21 sec)

Query OK, 0 rows affected (13.21 sec)

[root@localhost ~]# cat partition_maintenance_all.sql 
DELIMITER $$
CREATE PROCEDURE `partition_maintenance_all`(SCHEMA_NAME VARCHAR(32))
BEGIN
                CALL partition_maintenance(SCHEMA_NAME, 'history', 28, 24, 14);
                CALL partition_maintenance(SCHEMA_NAME, 'history_log', 28, 24, 14);
                CALL partition_maintenance(SCHEMA_NAME, 'history_str', 28, 24, 14);
                CALL partition_maintenance(SCHEMA_NAME, 'history_text', 28, 24, 14);
                CALL partition_maintenance(SCHEMA_NAME, 'history_uint', 28, 24, 14);
                CALL partition_maintenance(SCHEMA_NAME, 'trends', 730, 24, 14);
                CALL partition_maintenance(SCHEMA_NAME, 'trends_uint', 730, 24, 14);
END$$
DELIMITER ;

[root@localhost ~]#

以上代码部分的含义为(库名,表名,保存多少天的数据,每隔多久生成一个分区,本次生成多少分区)

mysql> source /root/partition_maintenance_all.sql;
Query OK, 0 rows affected (0.00 sec)

mysql> CALL partition_maintenance_all('zabbix');
+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607020000,1467475200) |
+-----------------------------------------------------------+
1 row in set (3.83 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607030000,1467561600) |
+-----------------------------------------------------------+
1 row in set (4.49 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607040000,1467648000) |
+-----------------------------------------------------------+
1 row in set (5.18 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607050000,1467734400) |
+-----------------------------------------------------------+
1 row in set (5.83 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607060000,1467820800) |
+-----------------------------------------------------------+
1 row in set (6.43 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607070000,1467907200) |
+-----------------------------------------------------------+
1 row in set (7.15 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607080000,1467993600) |
+-----------------------------------------------------------+
1 row in set (7.85 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607090000,1468080000) |
+-----------------------------------------------------------+
1 row in set (8.47 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607100000,1468166400) |
+-----------------------------------------------------------+
1 row in set (9.09 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607110000,1468252800) |
+-----------------------------------------------------------+
1 row in set (9.70 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607120000,1468339200) |
+-----------------------------------------------------------+
1 row in set (10.40 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607130000,1468425600) |
+-----------------------------------------------------------+
1 row in set (11.06 sec)

+-----------------------------------------------------------+
| msg                                                       |
+-----------------------------------------------------------+
| partition_create(zabbix,history,p201607140000,1468512000) |
+-----------------------------------------------------------+
1 row in set (11.68 sec)

+----------------+--------------------+
| table          | partitions_deleted |
+----------------+--------------------+
| zabbix.history | N/A                |
+----------------+--------------------+
1 row in set (12.34 sec)

+--------------------+--------------------+
| table              | partitions_deleted |
+--------------------+--------------------+
| zabbix.history_log | N/A                |
+--------------------+--------------------+
1 row in set (12.35 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607020000,1467475200) |
+---------------------------------------------------------------+
1 row in set (13.11 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607030000,1467561600) |
+---------------------------------------------------------------+
1 row in set (13.76 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607040000,1467648000) |
+---------------------------------------------------------------+
1 row in set (14.47 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607050000,1467734400) |
+---------------------------------------------------------------+
1 row in set (15.11 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607060000,1467820800) |
+---------------------------------------------------------------+
1 row in set (15.75 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607070000,1467907200) |
+---------------------------------------------------------------+
1 row in set (16.32 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607080000,1467993600) |
+---------------------------------------------------------------+
1 row in set (17.00 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607090000,1468080000) |
+---------------------------------------------------------------+
1 row in set (17.70 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607100000,1468166400) |
+---------------------------------------------------------------+
1 row in set (18.34 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607110000,1468252800) |
+---------------------------------------------------------------+
1 row in set (18.98 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607120000,1468339200) |
+---------------------------------------------------------------+
1 row in set (19.58 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607130000,1468425600) |
+---------------------------------------------------------------+
1 row in set (20.23 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,history_str,p201607140000,1468512000) |
+---------------------------------------------------------------+
1 row in set (20.89 sec)

+--------------------+--------------------+
| table              | partitions_deleted |
+--------------------+--------------------+
| zabbix.history_str | N/A                |
+--------------------+--------------------+
1 row in set (21.46 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607020000,1467475200) |
+----------------------------------------------------------------+
1 row in set (1 min 18.71 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607030000,1467561600) |
+----------------------------------------------------------------+
1 row in set (1 min 19.79 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607040000,1467648000) |
+----------------------------------------------------------------+
1 row in set (1 min 20.55 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607050000,1467734400) |
+----------------------------------------------------------------+
1 row in set (1 min 21.45 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607060000,1467820800) |
+----------------------------------------------------------------+
1 row in set (1 min 22.79 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607070000,1467907200) |
+----------------------------------------------------------------+
1 row in set (1 min 23.62 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607080000,1467993600) |
+----------------------------------------------------------------+
1 row in set (1 min 24.46 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607090000,1468080000) |
+----------------------------------------------------------------+
1 row in set (1 min 25.47 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607100000,1468166400) |
+----------------------------------------------------------------+
1 row in set (1 min 26.69 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607110000,1468252800) |
+----------------------------------------------------------------+
1 row in set (1 min 27.87 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607120000,1468339200) |
+----------------------------------------------------------------+
1 row in set (1 min 29.12 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607130000,1468425600) |
+----------------------------------------------------------------+
1 row in set (1 min 30.24 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_text,p201607140000,1468512000) |
+----------------------------------------------------------------+
1 row in set (1 min 31.29 sec)

+---------------------+--------------------+
| table               | partitions_deleted |
+---------------------+--------------------+
| zabbix.history_text | N/A                |
+---------------------+--------------------+
1 row in set (1 min 32.63 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607020000,1467475200) |
+----------------------------------------------------------------+
1 row in set (1 min 40.29 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607030000,1467561600) |
+----------------------------------------------------------------+
1 row in set (1 min 41.40 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607040000,1467648000) |
+----------------------------------------------------------------+
1 row in set (1 min 42.28 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607050000,1467734400) |
+----------------------------------------------------------------+
1 row in set (1 min 43.24 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607060000,1467820800) |
+----------------------------------------------------------------+
1 row in set (1 min 44.65 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607070000,1467907200) |
+----------------------------------------------------------------+
1 row in set (1 min 45.73 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607080000,1467993600) |
+----------------------------------------------------------------+
1 row in set (1 min 46.76 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607090000,1468080000) |
+----------------------------------------------------------------+
1 row in set (1 min 47.60 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607100000,1468166400) |
+----------------------------------------------------------------+
1 row in set (1 min 48.65 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607110000,1468252800) |
+----------------------------------------------------------------+
1 row in set (1 min 49.80 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607120000,1468339200) |
+----------------------------------------------------------------+
1 row in set (1 min 50.83 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607130000,1468425600) |
+----------------------------------------------------------------+
1 row in set (1 min 51.62 sec)

+----------------------------------------------------------------+
| msg                                                            |
+----------------------------------------------------------------+
| partition_create(zabbix,history_uint,p201607140000,1468512000) |
+----------------------------------------------------------------+
1 row in set (1 min 52.79 sec)

+---------------------+--------------------+
| table               | partitions_deleted |
+---------------------+--------------------+
| zabbix.history_uint | N/A                |
+---------------------+--------------------+
1 row in set (1 min 53.63 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607020000,1467475200) |
+----------------------------------------------------------+
1 row in set (2 min 4.97 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607030000,1467561600) |
+----------------------------------------------------------+
1 row in set (2 min 6.04 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607040000,1467648000) |
+----------------------------------------------------------+
1 row in set (2 min 6.69 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607050000,1467734400) |
+----------------------------------------------------------+
1 row in set (2 min 7.52 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607060000,1467820800) |
+----------------------------------------------------------+
1 row in set (2 min 8.28 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607070000,1467907200) |
+----------------------------------------------------------+
1 row in set (2 min 9.05 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607080000,1467993600) |
+----------------------------------------------------------+
1 row in set (2 min 9.64 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607090000,1468080000) |
+----------------------------------------------------------+
1 row in set (2 min 10.35 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607100000,1468166400) |
+----------------------------------------------------------+
1 row in set (2 min 11.09 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607110000,1468252800) |
+----------------------------------------------------------+
1 row in set (2 min 11.73 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607120000,1468339200) |
+----------------------------------------------------------+
1 row in set (2 min 12.53 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607130000,1468425600) |
+----------------------------------------------------------+
1 row in set (2 min 13.26 sec)

+----------------------------------------------------------+
| msg                                                      |
+----------------------------------------------------------+
| partition_create(zabbix,trends,p201607140000,1468512000) |
+----------------------------------------------------------+
1 row in set (2 min 14.34 sec)

+---------------+--------------------+
| table         | partitions_deleted |
+---------------+--------------------+
| zabbix.trends | N/A                |
+---------------+--------------------+
1 row in set (2 min 15.33 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607020000,1467475200) |
+---------------------------------------------------------------+
1 row in set (2 min 43.90 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607030000,1467561600) |
+---------------------------------------------------------------+
1 row in set (2 min 44.79 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607040000,1467648000) |
+---------------------------------------------------------------+
1 row in set (2 min 45.53 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607050000,1467734400) |
+---------------------------------------------------------------+
1 row in set (2 min 46.19 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607060000,1467820800) |
+---------------------------------------------------------------+
1 row in set (2 min 46.95 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607070000,1467907200) |
+---------------------------------------------------------------+
1 row in set (2 min 47.83 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607080000,1467993600) |
+---------------------------------------------------------------+
1 row in set (2 min 49.15 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607090000,1468080000) |
+---------------------------------------------------------------+
1 row in set (2 min 50.01 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607100000,1468166400) |
+---------------------------------------------------------------+
1 row in set (2 min 50.86 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607110000,1468252800) |
+---------------------------------------------------------------+
1 row in set (2 min 51.67 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607120000,1468339200) |
+---------------------------------------------------------------+
1 row in set (2 min 52.33 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607130000,1468425600) |
+---------------------------------------------------------------+
1 row in set (2 min 52.98 sec)

+---------------------------------------------------------------+
| msg                                                           |
+---------------------------------------------------------------+
| partition_create(zabbix,trends_uint,p201607140000,1468512000) |
+---------------------------------------------------------------+
1 row in set (2 min 53.82 sec)

+--------------------+--------------------+
| table              | partitions_deleted |
+--------------------+--------------------+
| zabbix.trends_uint | N/A                |
+--------------------+--------------------+
1 row in set (2 min 54.70 sec)

Query OK, 0 rows affected (2 min 54.70 sec)

mysql> 

可以加入计划任务每天执行一次


11 11 * * * mysql -uzabbix -pzabbix zabbix -e "CALL partition_maintenance_all('zabbix');"

如果想改变数据保存的天数,可以修改上面的28或者最后的14,周期24小时,不要调整;
另外按照官方所述,应取消历史记录和趋势的内部管家,并且选中覆盖监控项历史期间,按照文章所述默认天数分别为历史记录28天和趋势730天。

YUM方式安装Zabbix

YUM方式安装Zabbix

1、选择适用的源扩展
# rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
# rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
# rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/5/x86_64/zabbix-release-2.4-1.el5.noarch.rpm

# yum groupinstall “Development Tools” -y
# yum groupinstall “Development Libraries” -y
# yum install zlib libpng libjpeg fontconfig gd libxml2 libgd-devel libpng-devel libjpeg-devel zlib-devel gd-devel freetype freetype-devel libxml libxml-devel -y
# yum install cmake -y
# yum install ncurses ncurses-devel -y
# yum install libxml2 libxml2-devel -y
# yum install openssl openssl-devel -y
# yum install curl curl-devel -y
# yum install libevent libevent-devel -y
# yum -y install net-tools lrzsz gcc gcc-c++ make cmake libxml2-devel openssl-devel curl curl-devel unzip sudo ntp libaio-devel wget vim ncurses-devel autoconf automake zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel* python-devel -y

# yum install httpd php mysql mysql-server php-mysql

2、在监控端安装zabbix server和zabbix agent,再被监控端安装zabbix agent

# yum install zabbix-server-mysql zabbix-web-mysql zabbix-get zabbix-sender

# yum install zabbix-agent zabbix-sender

3、监控端数据库导入
mysql> create database zabbix character set utf8;

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;

mysql> flush privileges;

# cd /usr/share/doc/zabbix-server-mysql-2.4.0/create
# mysql -uroot zabbix < schema.sql # mysql -uroot zabbix < images.sql # mysql -uroot zabbix < data.sql 4、配置数据库信息 # vi /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix Start Zabbix server process. # service zabbix-server start 5、PHP参数值建议 max_execution_time 300 memory_limit 128M post_max_size 16M upload_max_filesize 2M max_input_time 300 6、启动服务 # service httpd restart # service mysqld restart # service zabbix-server restart # service zabbix-agent restart

Zabbix监控Key相关

1、监控进程
/usr/local/zabbix/bin/zabbix_get -s 127.0.0.1 -k “net.tcp.service[http]”

2、监控端口
/usr/local/zabbix/bin/zabbix_get -s 127.0.0.1 -k “net.tcp.port[,80]” 结果:1存在,0不存在;

3、进程数量
/usr/local/zabbix/bin/zabbix_get -s 127.0.0.1 -k “proc.num[]”
/usr/local/zabbix/bin/zabbix_get -s 127.0.0.1 -k “proc.num[httpd]”

4、其他
vm.memory.size[available]
vfs.file.cksum[/etc/passwd]
system.cpu.switches
system.cpu.num
system.cpu.util[,user]
system.cpu.util[,nice]
system.cpu.util[,system]
system.cpu.util[,iowait]
system.cpu.util[,idle]
system.cpu.util[,interrupt]
system.cpu.util[,steal]
system.cpu.util[,softirq]
system.swap.size[,free]
system.swap.size[,pfree]
system.boottime
system.localtime
system.hostname
system.cpu.intr
kernel.maxfiles
kernel.maxproc
system.users.num
proc.num[]
proc.num[,,run]
system.cpu.load[percpu,avg1]
system.cpu.load[percpu,avg5]
system.cpu.load[percpu,avg15]
system.uname
system.uptime
vm.memory.size[total]
system.swap.size[,total]
net.tcp.service[ftp,,155]
net.tcp.service[http]
net.tcp.service.perf[http,,8080]
net.tcp.service[service,, ]