Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk importing of uptime monitoring servers to the system #1803

Open
gorkem-bwl opened this issue Feb 23, 2025 · 2 comments
Open

Bulk importing of uptime monitoring servers to the system #1803

gorkem-bwl opened this issue Feb 23, 2025 · 2 comments
Assignees
Labels
api API related issue/request backend
Milestone

Comments

@gorkem-bwl
Copy link
Contributor

Here are some details and use-cases:

To make migrations easier, we can add an automatic server addition feature to Checkmate. This will allow admins to upload a CSV file with server details (URL, display name, and monitor frequency) directly from the UI, saving time and effort.

How it works:

  • Admins click the "Add Servers (Uptime)" button on the dashboard.
  • They upload a CSV file with server info.
  • Checkmate processes the file and adds the servers to the database quickly.

Benefits are faster migration for users switching from other tools and improved user interface.

We already have a function in Settings that adds up to 300 servers at once using a static file. This can be adapted for CSV uploads, making implementation faster and easier. It will also give you an understanding of how adding servers work in general.

The bare minimum of data need to create a Monitor is as follows:

{
   name: "Your Monitor Name"
   url: "www.your-url.com"
}

Everything else is optional, but can be included.

Important to note that the correct teamId must be provided or users will not be able to view their monitors.

Monitor schema for reference:

import mongoose from "mongoose";

const MonitorSchema = mongoose.Schema(
	{
		userId: {
			type: mongoose.Schema.Types.ObjectId,
			ref: "User",
			immutable: true,
			required: true,
		},
		teamId: {
			type: mongoose.Schema.Types.ObjectId,
			ref: "Team",
			immutable: true,
			required: true,
		},
		name: {
			type: String,
			required: true,
		},
		description: {
			type: String,
		},
		status: {
			type: Boolean,
			default: undefined,
		},
		type: {
			type: String,
			required: true,
			enum: [
				"http",
				"ping",
				"pagespeed",
				"hardware",
				"docker",
				"port",
				"distributed_http",
			],
		},
		url: {
			type: String,
			required: true,
		},
		port: {
			type: Number,
		},
		isActive: {
			type: Boolean,
			default: true,
		},
		interval: {
			// in milliseconds
			type: Number,
			default: 60000,
		},
		uptimePercentage: {
			type: Number,
			default: undefined,
		},
		thresholds: {
			type: {
				usage_cpu: { type: Number },
				usage_memory: { type: Number },
				usage_disk: { type: Number },
			},
			_id: false,
		},
		notifications: [
			{
				type: mongoose.Schema.Types.ObjectId,
				ref: "Notification",
			},
		],
		secret: {
			type: String,
		},
	},
	{
		timestamps: true,
	}
);

export default mongoose.model("Monitor", MonitorSchema);
@gorkem-bwl gorkem-bwl added api API related issue/request backend labels Feb 23, 2025
@gorkem-bwl gorkem-bwl added this to the 3.0 milestone Feb 23, 2025
@YinDongFang
Copy link
Contributor

May I take up this issue?

@gorkem-bwl
Copy link
Contributor Author

Yes, please. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API related issue/request backend
Projects
None yet
Development

No branches or pull requests

2 participants