public SenderResponse Send(string host, string itemKey, string value, int timeout = 500)
 {
     var item = new ItemValue();
     item.Host = host;
     item.Key = itemKey;
     item.Value = value;
     return Send(item, timeout);
 }
Пример #2
0
        protected override void ReportHealth(HealthStatus status)
        {
            ItemValue item = null;

            foreach (var itm in status.Results)
            {
                if (null != ZabbixConfig)
                {
                    ZabbixConfig.TryCreateTrapperItem(SubfolderName(typeof(HealthStatus).Name, itm.Name), Unit.None.ToString(), ZabbixApi.Entities.Item.ValueType.NumericUnsigned, ZabbixApi.Entities.Item.DataType.Boolean);
                    ZabbixConfig.TryCreateTrapperItem(SubfolderName(typeof(HealthStatus).Name, SubfolderName(itm.Name, "Message")), Unit.None.ToString(), ZabbixApi.Entities.Item.ValueType.Text);
                }

                item = NewItemValue(SubfolderName(typeof(HealthStatus).Name, itm.Name), itm.Check.IsHealthy);
                _sendQueue.Enqueue(item);
                if (!itm.Check.IsHealthy)
                {
                    // 仅在健康检查不通过的时候上报具体信息
                    item = NewItemValue(SubfolderName(typeof(HealthStatus).Name, SubfolderName(itm.Name, "Message")), itm.Check.Message);
                    _sendQueue.Enqueue(item);
                }
            }
        }
 public SenderResponse Send(ItemValue value, int timeout = 500)
 {
     return(Send(new ItemValue[] { value }, timeout));
 }
 public SenderResponse Send(ItemValue value, int timeout = 500)
 {
     return Send(new ItemValue[] { value }, timeout);
 }