Exemplo n.º 1
0
        /// <summary>
        /// Получает текущее значение счетчика отправленных писем
        /// </summary>
        private void GetStatus(object sender)
        {
            var curSendCount  = SendCounter.Read();
            var curErrorCount = ErrorCounter.Read();

            //If massMail object was recreated
            LastSendCount  = (curSendCount < LastSendCount) ? 0 : LastSendCount;
            LastErrorCount = (curErrorCount < LastErrorCount) ? 0 : LastErrorCount;
            Zabbix.Sender.SendData(new ZabbixItem {
                Host = Config.HostKey, Key = Config.SendCountKey, Value = (curSendCount - LastSendCount).ToString(CultureInfo.InvariantCulture)
            });
            Zabbix.Sender.SendData(new ZabbixItem {
                Host = Config.HostKey, Key = Config.ErrorCountKey, Value = (curErrorCount - LastErrorCount).ToString(CultureInfo.InvariantCulture)
            });
            Logger.Log.Debug("Send to zabbix - send: {0}, errors: {1}", curSendCount - LastSendCount, curErrorCount - LastErrorCount);
            Logger.Log.Debug("Total - send: {0}, errors: {1}", curSendCount, curErrorCount);
            LastSendCount  = curSendCount;
            LastErrorCount = curErrorCount;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Обработчик события об отправленных сообщениях
 /// </summary>
 public void OnMessagesSend(long sendCount, long errorCount)
 {
     SendCounter.Add(sendCount);
     ErrorCounter.Add(errorCount);
     Logger.Log.Debug("Messages processed - send: {0} + errors: {1}", SendCounter.Read(), ErrorCounter.Read());
 }