forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
834 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$env:OUTPUT_DIR = "$PSScriptRoot/dist" | ||
|
||
.\set-ubuntu-noble.ps1 | ||
.\set-raven-platform-amd64.ps1 | ||
.\set-raven-version-env.ps1 | ||
|
||
.\build-deb.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
$env:DISTRO_NAME = "ubuntu" | ||
$env:DISTRO_VERSION = "24.04" | ||
$env:DISTRO_VERSION_NAME ="noble" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export DISTRO_NAME="ubuntu" | ||
export DISTRO_VERSION="24.04" | ||
export DISTRO_VERSION_NAME="noble" |
105 changes: 105 additions & 0 deletions
105
src/Raven.Server/Monitoring/Snmp/Objects/Database/5.1/5.1.11/ActiveOngoingTasksBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Lextm.SharpSnmpLib; | ||
using Raven.Client.Documents.Subscriptions; | ||
using Raven.Client.Json.Serialization; | ||
using Raven.Client.ServerWide; | ||
using Raven.Server.ServerWide; | ||
using Raven.Server.ServerWide.Context; | ||
|
||
namespace Raven.Server.Monitoring.Snmp.Objects.Database; | ||
|
||
public abstract class ActiveOngoingTasksBase : DatabaseBase<Integer32> | ||
{ | ||
protected ActiveOngoingTasksBase(ServerStore serverStore, string dots) | ||
: base(serverStore, dots) | ||
{ | ||
} | ||
|
||
protected override IEnumerable<RawDatabaseRecord> GetDatabases(TransactionOperationContext context) | ||
{ | ||
foreach (var database in base.GetDatabases(context)) | ||
{ | ||
if (database.IsDisabled) | ||
continue; | ||
|
||
if (ServerStore.DatabasesLandlord.IsDatabaseLoaded(database.DatabaseName) == false) | ||
continue; | ||
|
||
yield return database; | ||
} | ||
} | ||
|
||
protected abstract int GetCount(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database); | ||
|
||
protected override Integer32 GetData() | ||
{ | ||
var count = 0; | ||
using (ServerStore.ContextPool.AllocateOperationContext(out TransactionOperationContext context)) | ||
using (context.OpenReadTransaction()) | ||
{ | ||
var rachisState = ServerStore.CurrentRachisState; | ||
var nodeTag = ServerStore.NodeTag; | ||
|
||
foreach (var database in GetDatabases(context)) | ||
{ | ||
count += GetCount(context, rachisState, nodeTag, database); | ||
} | ||
} | ||
|
||
return new Integer32(count); | ||
} | ||
|
||
protected static int GetNumberOfActiveElasticSearchEtls(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.ElasticSearchEtls.Where(x => x.Disabled == false)); | ||
|
||
protected static int GetNumberOfActiveExternalReplications(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.ExternalReplications.Where(x => x.Disabled == false)); | ||
|
||
protected static int GetNumberOfActiveOlapEtls(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.OlapEtls.Where(x => x.Disabled == false)); | ||
|
||
protected static int GetNumberOfActivePeriodicBackups(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.PeriodicBackups.Where(x => x.Disabled == false)); | ||
|
||
protected static int GetNumberOfActiveQueueEtls(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.QueueEtls.Where(x => x.Disabled == false)); | ||
|
||
protected static int GetNumberOfActiveRavenEtls(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.RavenEtls.Where(x => x.Disabled == false)); | ||
|
||
protected static int GetNumberOfActiveSinkPullReplications(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.SinkPullReplications.Where(x => x.Disabled == false)); | ||
|
||
protected static int GetNumberOfActiveSqlEtls(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.SqlEtls.Where(x => x.Disabled == false)); | ||
|
||
protected static int GetNumberOfActiveSubscriptions(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database) | ||
{ | ||
var count = 0; | ||
foreach (var kvp in ClusterStateMachine.ReadValuesStartingWith(context, SubscriptionState.SubscriptionPrefix(database.DatabaseName))) | ||
{ | ||
var subscriptionState = JsonDeserializationClient.SubscriptionState(kvp.Value); | ||
if (subscriptionState.Disabled) | ||
continue; | ||
|
||
var responsibleNode = database.Topology.WhoseTaskIsIt(rachisState, subscriptionState); | ||
if (responsibleNode != nodeTag) | ||
continue; | ||
|
||
count++; | ||
} | ||
|
||
return count; | ||
} | ||
|
||
private static int CountTasks(RachisState rachisState, string nodeTag, DatabaseTopology databaseTopology, IEnumerable<IDatabaseTask> tasks) | ||
{ | ||
if (tasks == null) | ||
return 0; | ||
|
||
var count = 0; | ||
foreach (var task in tasks) | ||
{ | ||
var responsibleNode = databaseTopology.WhoseTaskIsIt(rachisState, task); | ||
if (responsibleNode != nodeTag) | ||
continue; | ||
|
||
count++; | ||
} | ||
|
||
return count; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/Raven.Server/Monitoring/Snmp/Objects/Database/5.1/5.1.11/OngoingTasksBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Lextm.SharpSnmpLib; | ||
using Raven.Client.Documents.Subscriptions; | ||
using Raven.Server.ServerWide; | ||
using Raven.Server.ServerWide.Context; | ||
|
||
namespace Raven.Server.Monitoring.Snmp.Objects.Database; | ||
|
||
public abstract class OngoingTasksBase : DatabaseBase<Integer32> | ||
{ | ||
protected OngoingTasksBase(ServerStore serverStore, string dots) | ||
: base(serverStore, dots) | ||
{ | ||
} | ||
|
||
protected override IEnumerable<RawDatabaseRecord> GetDatabases(TransactionOperationContext context) | ||
{ | ||
foreach (var database in base.GetDatabases(context)) | ||
{ | ||
if (database.IsDisabled) | ||
continue; | ||
|
||
yield return database; | ||
} | ||
} | ||
|
||
protected abstract int GetCount(TransactionOperationContext context, RawDatabaseRecord database); | ||
|
||
protected override Integer32 GetData() | ||
{ | ||
var count = 0; | ||
using (ServerStore.ContextPool.AllocateOperationContext(out TransactionOperationContext context)) | ||
using (context.OpenReadTransaction()) | ||
{ | ||
foreach (var database in GetDatabases(context)) | ||
{ | ||
count += GetCount(context, database); | ||
} | ||
} | ||
|
||
return new Integer32(count); | ||
} | ||
|
||
protected internal static int GetNumberOfElasticSearchEtls(RawDatabaseRecord database) => database.ElasticSearchEtls?.Count(x => x.Disabled == false) ?? 0; | ||
|
||
protected internal static int GetNumberOfExternalReplications(RawDatabaseRecord database) => database.ExternalReplications?.Count(x => x.Disabled == false) ?? 0; | ||
|
||
protected internal static int GetNumberOfOlapEtls(RawDatabaseRecord database) => database.OlapEtls?.Count(x => x.Disabled == false) ?? 0; | ||
|
||
protected internal static int GetNumberOfPeriodicBackups(RawDatabaseRecord database) => database.PeriodicBackups?.Count(x => x.Disabled == false) ?? 0; | ||
|
||
protected internal static int GetNumberOfQueueEtls(RawDatabaseRecord database) => database.QueueEtls?.Count(x => x.Disabled == false) ?? 0; | ||
|
||
protected internal static int GetNumberOfRavenEtls(RawDatabaseRecord database) => database.RavenEtls?.Count(x => x.Disabled == false) ?? 0; | ||
|
||
protected internal static int GetNumberOfSinkPullReplications(RawDatabaseRecord database) => database.SinkPullReplications?.Count(x => x.Disabled == false) ?? 0; | ||
|
||
protected internal static int GetNumberOfSqlEtls(RawDatabaseRecord database) => database.SqlEtls?.Count(x => x.Disabled == false) ?? 0; | ||
|
||
protected internal static int GetNumberOfSubscriptions(TransactionOperationContext context, RawDatabaseRecord database) | ||
{ | ||
var count = 0; | ||
foreach (var kvp in ClusterStateMachine.ReadValuesStartingWith(context, SubscriptionState.SubscriptionPrefix(database.DatabaseName))) | ||
{ | ||
if (kvp.Value.TryGet(nameof(SubscriptionState.Disabled), out bool disabled) && disabled) | ||
continue; | ||
|
||
count++; | ||
} | ||
|
||
return count; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...aven.Server/Monitoring/Snmp/Objects/Database/5.1/5.1.11/TotalNumberOfActiveBackupTasks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Raven.Client.ServerWide; | ||
using Raven.Server.ServerWide; | ||
using Raven.Server.ServerWide.Context; | ||
|
||
namespace Raven.Server.Monitoring.Snmp.Objects.Database | ||
{ | ||
public class TotalNumberOfActiveBackupTasks : ActiveOngoingTasksBase | ||
{ | ||
public TotalNumberOfActiveBackupTasks(ServerStore serverStore) | ||
: base(serverStore, SnmpOids.Databases.General.TotalNumberOfActiveBackupTasks) | ||
{ | ||
} | ||
|
||
protected override int GetCount(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database) | ||
{ | ||
return GetNumberOfActivePeriodicBackups(rachisState, nodeTag, database); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...r/Monitoring/Snmp/Objects/Database/5.1/5.1.11/TotalNumberOfActiveElasticSearchEtlTasks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Raven.Client.ServerWide; | ||
using Raven.Server.ServerWide; | ||
using Raven.Server.ServerWide.Context; | ||
|
||
namespace Raven.Server.Monitoring.Snmp.Objects.Database | ||
{ | ||
public class TotalNumberOfActiveElasticSearchEtlTasks : ActiveOngoingTasksBase | ||
{ | ||
public TotalNumberOfActiveElasticSearchEtlTasks(ServerStore serverStore) | ||
: base(serverStore, SnmpOids.Databases.General.TotalNumberOfActiveElasticSearchEtlTasks) | ||
{ | ||
} | ||
|
||
protected override int GetCount(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database) | ||
{ | ||
return GetNumberOfActiveElasticSearchEtls(rachisState, nodeTag, database); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...onitoring/Snmp/Objects/Database/5.1/5.1.11/TotalNumberOfActiveExternalReplicationTasks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="DatabaseOpenedCount.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using Lextm.SharpSnmpLib; | ||
using Raven.Client.ServerWide; | ||
using Raven.Server.ServerWide; | ||
using Raven.Server.ServerWide.Context; | ||
|
||
namespace Raven.Server.Monitoring.Snmp.Objects.Database | ||
{ | ||
public class TotalNumberOfActiveExternalReplicationTasks : ActiveOngoingTasksBase | ||
{ | ||
public TotalNumberOfActiveExternalReplicationTasks(ServerStore serverStore) | ||
: base(serverStore, SnmpOids.Databases.General.TotalNumberOfActiveExternalReplicationTasks) | ||
{ | ||
} | ||
|
||
protected override int GetCount(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database) | ||
{ | ||
return GetNumberOfActiveExternalReplications(rachisState, nodeTag, database); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...ven.Server/Monitoring/Snmp/Objects/Database/5.1/5.1.11/TotalNumberOfActiveOlapEtlTasks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Raven.Client.ServerWide; | ||
using Raven.Server.ServerWide; | ||
using Raven.Server.ServerWide.Context; | ||
|
||
namespace Raven.Server.Monitoring.Snmp.Objects.Database | ||
{ | ||
public class TotalNumberOfActiveOlapEtlTasks : ActiveOngoingTasksBase | ||
{ | ||
public TotalNumberOfActiveOlapEtlTasks(ServerStore serverStore) | ||
: base(serverStore, SnmpOids.Databases.General.TotalNumberOfActiveOlapEtlTasks) | ||
{ | ||
} | ||
|
||
protected override int GetCount(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database) | ||
{ | ||
return GetNumberOfActiveOlapEtls(rachisState, nodeTag, database); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ven.Server/Monitoring/Snmp/Objects/Database/5.1/5.1.11/TotalNumberOfActiveOngoingTasks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Lextm.SharpSnmpLib; | ||
using Raven.Client.ServerWide; | ||
using Raven.Server.ServerWide; | ||
using Raven.Server.ServerWide.Context; | ||
|
||
namespace Raven.Server.Monitoring.Snmp.Objects.Database | ||
{ | ||
public class TotalNumberOfActiveOngoingTasks : ActiveOngoingTasksBase | ||
{ | ||
public TotalNumberOfActiveOngoingTasks(ServerStore serverStore) | ||
: base(serverStore, SnmpOids.Databases.General.TotalNumberOfActiveOngoingTasks) | ||
{ | ||
} | ||
|
||
protected override int GetCount(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database) | ||
{ | ||
var count = GetNumberOfActiveElasticSearchEtls(rachisState, nodeTag, database); | ||
count += GetNumberOfActiveExternalReplications(rachisState, nodeTag, database); | ||
count += GetNumberOfActiveOlapEtls(rachisState, nodeTag, database); | ||
count += GetNumberOfActivePeriodicBackups(rachisState, nodeTag, database); | ||
count += GetNumberOfActiveQueueEtls(rachisState, nodeTag, database); | ||
count += GetNumberOfActiveRavenEtls(rachisState, nodeTag, database); | ||
count += GetNumberOfActiveSinkPullReplications(rachisState, nodeTag, database); | ||
count += GetNumberOfActiveSqlEtls(rachisState, nodeTag, database); | ||
count += GetNumberOfActiveSubscriptions(context, rachisState, nodeTag, database); | ||
|
||
return count; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...itoring/Snmp/Objects/Database/5.1/5.1.11/TotalNumberOfActivePullReplicationAsSinkTasks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Raven.Client.ServerWide; | ||
using Raven.Server.ServerWide; | ||
using Raven.Server.ServerWide.Context; | ||
|
||
namespace Raven.Server.Monitoring.Snmp.Objects.Database | ||
{ | ||
public class TotalNumberOfActivePullReplicationAsSinkTasks : ActiveOngoingTasksBase | ||
{ | ||
public TotalNumberOfActivePullReplicationAsSinkTasks(ServerStore serverStore) | ||
: base(serverStore, SnmpOids.Databases.General.TotalNumberOfActivePullReplicationAsSinkTasks) | ||
{ | ||
} | ||
|
||
protected override int GetCount(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database) | ||
{ | ||
return GetNumberOfActiveSinkPullReplications(rachisState, nodeTag, database); | ||
} | ||
} | ||
} |
Oops, something went wrong.