protected override TimeTicks GetData() { if (_statistics.LastAuthorizedNonClusterAdminRequestTime.HasValue) { return(SnmpValuesHelper.TimeSpanToTimeTicks(SystemTime.UtcNow - _statistics.LastAuthorizedNonClusterAdminRequestTime.Value)); } return(SnmpValuesHelper.TimeTicksMax); }
protected override TimeTicks GetData() { if (_statistics.LastRequestTime.HasValue) { return(SnmpValuesHelper.TimeSpanToTimeTicks(SystemTime.UtcNow - _statistics.LastRequestTime.Value)); } return(null); }
protected override TimeTicks GetData(DocumentDatabase database) { var index = GetIndex(database); var stats = index.GetStats(); if (stats.LastQueryingTime.HasValue) { return(SnmpValuesHelper.TimeSpanToTimeTicks(SystemTime.UtcNow - stats.LastQueryingTime.Value)); } return(null); }
public void Given_NoDbs_ReturnsZero() { var backupTimes = new DateTime?[] {}; SetupDatabasesBackupTimes(backupTimes); var result = DatabaseOldestBackup.GetTimeSinceOldestBackupInternal(_backupDates.Keys.ToList(), GetLastBackupDate, _time); Assert.Equal(TimeSpan.Zero, result); Assert.Equal(SnmpValuesHelper.TimeTicksZero, SnmpValuesHelper.TimeSpanToTimeTicks(result)); }
protected override TimeTicks GetData() { var status = _store.LicenseManager.LicenseStatus; if (status.Expiration.HasValue == false) { return(null); } var timeLeft = status.Expiration.Value - SystemTime.UtcNow; return(SnmpValuesHelper.TimeSpanToTimeTicks(timeLeft.TotalMilliseconds > 0 ? timeLeft : TimeSpan.Zero)); }
protected override TimeTicks GetData() { var holder = _store.Server.Certificate; if (holder == null || holder.Certificate == null) { return(null); } var notAfter = holder.Certificate.NotAfter; var timeLeft = notAfter - SystemTime.UtcNow; return(SnmpValuesHelper.TimeSpanToTimeTicks(timeLeft.TotalMilliseconds > 0 ? timeLeft : TimeSpan.Zero)); }
public void GivenDatabaseBackedUp_MoreThanMaxTimeTicksAgo_ReturnsTimespanMax() { var maxTimeTicksTimespan = SnmpValuesHelper.TimeTicksMax.ToTimeSpan(); var backupTimes = new DateTime?[] { _time.GetUtcNow().Subtract(maxTimeTicksTimespan).Subtract(TimeSpan.FromDays(1)) }; SetupDatabasesBackupTimes(backupTimes); var result = DatabaseOldestBackup.GetTimeSinceOldestBackupInternal(_backupDates.Keys.ToList(), GetLastBackupDate, _time); Assert.True(result > SnmpValuesHelper.TimeSpanSnmpMax); Assert.Equal(SnmpValuesHelper.TimeTicksMax, SnmpValuesHelper.TimeSpanToTimeTicks(result)); }
protected override TimeTicks GetData() { return(SnmpValuesHelper.TimeSpanToTimeTicks(_statistics.UpTime)); }
protected override TimeTicks GetData(DocumentDatabase database) { return(SnmpValuesHelper.TimeSpanToTimeTicks(SystemTime.UtcNow - database.StartTime)); }
protected override TimeTicks GetData() { var timeOfOldestBackup = GetTimeSinceOldestBackup(_serverStore); return(SnmpValuesHelper.TimeSpanToTimeTicks(timeOfOldestBackup)); }