Installation
Getting started with 9n9s is quick and straightforward. This guide covers everything you need to begin monitoring your systems and processes.
Account Setup
Section titled “Account Setup”1. Create Your Account
Section titled “1. Create Your Account”Visit 9n9s.com/sign-up to create your free account:
- Sign up with your email and password
- Verify your email address via the confirmation link
- Create your organization - this will be your team’s workspace
- Set up your first project to organize your monitors
2. Account Security
Section titled “2. Account Security”We highly recommend enabling two-factor authentication (2FA) immediately:
- Go to Settings > Security in your dashboard
- Click Enable Two-Factor Authentication
- Scan the QR code with your authenticator app (Google Authenticator, Authy, etc.)
- Enter the verification code to confirm setup
- Save your backup codes in a secure location
3. Organization Configuration
Section titled “3. Organization Configuration”Configure your organization settings:
- Organization Name: Your team or company name
- Timezone: Default timezone for cron schedules
- Notification Preferences: Default channels for alerts
- Billing Information: Add payment method for paid features
SDK Installation
Section titled “SDK Installation”Install the 9n9s SDK for your preferred programming language to integrate heartbeat monitoring into your applications.
Python
Section titled “Python”# Install via pippip install 9n9s
# Or using poetrypoetry add 9n9s
# Or using pipenvpipenv install 9n9sBasic Usage:
from nines import Nines
# Initialize with your heartbeat monitor IDnines = Nines("your-heartbeat-monitor-id")
# Signal successful completionnines.pulse()
# Track execution time@nines.timedef my_background_job(): # Your job logic here process_data()Node.js / TypeScript
Section titled “Node.js / TypeScript”# Install via npmnpm install @9n9s/sdk
# Or using yarnyarn add @9n9s/sdk
# Or using pnpmpnpm add @9n9s/sdkBasic Usage:
import { Nines } from "@9n9s/sdk";
// Initialize with your heartbeat monitor IDconst nines = new Nines("your-heartbeat-monitor-id");
// Signal successful completionawait nines.pulse();
// Track execution timeawait nines.time(async () => { // Your job logic here await processData();});# Install the Go modulego get github.com/9n9s-io/9n9s-goBasic Usage:
package main
import ( "github.com/9n9s-io/9n9s-go")
func main() { // Initialize with your heartbeat monitor ID nines := nines.New("your-heartbeat-monitor-id")
// Signal successful completion nines.Pulse()
// Track execution time err := nines.Time(func() error { // Your job logic here return processData() })
if err != nil { // Handle error }}Other Languages
Section titled “Other Languages”SDKs for additional languages are in development:
- Java: Coming Q2 2024
- .NET/C#: Coming Q2 2024
- PHP: Coming Q3 2024
- Ruby: Coming Q3 2024
- Rust: Coming Q3 2024
For languages without official SDKs, you can use the HTTP API endpoints directly.
CLI Tool Installation
Section titled “CLI Tool Installation”The 9n9s CLI tool provides command-line access to manage monitors, send pulses, and automate configuration.
Install via Package Managers
Section titled “Install via Package Managers”macOS (Homebrew):
# Add the 9n9s tapbrew tap 9n9s-io/9n9s
# Install the CLIbrew install 9n9s-cliLinux (apt):
# Add the repositorycurl -fsSL https://pkg.9n9s.com/public.key | sudo apt-key add -echo "deb https://pkg.9n9s.com/apt stable main" | sudo tee /etc/apt/sources.list.d/9n9s.list
# Update and installsudo apt updatesudo apt install 9n9s-cliLinux (yum/dnf):
# Add the repositorysudo tee /etc/yum.repos.d/9n9s.repo << EOF[9n9s]name=9n9s Repositorybaseurl=https://pkg.9n9s.com/rpmenabled=1gpgcheck=1gpgkey=https://pkg.9n9s.com/public.keyEOF
# Installsudo yum install 9n9s-cli# Or on Fedora/RHEL 8+sudo dnf install 9n9s-cliInstall via Binary Download
Section titled “Install via Binary Download”Download pre-built binaries from the releases page:
# Download for Linuxcurl -L -o 9n9s-cli https://github.com/9n9s-io/9n9s-cli/releases/latest/download/9n9s-cli-linux-amd64
# Download for macOScurl -L -o 9n9s-cli https://github.com/9n9s-io/9n9s-cli/releases/latest/download/9n9s-cli-darwin-amd64
# Download for Windowscurl -L -o 9n9s-cli.exe https://github.com/9n9s-io/9n9s-cli/releases/latest/download/9n9s-cli-windows-amd64.exe
# Make executable (Linux/macOS)chmod +x 9n9s-cli
# Move to PATHsudo mv 9n9s-cli /usr/local/bin/Build from Source
Section titled “Build from Source”# Clone the repositorygit clone https://github.com/9n9s-io/9n9s-cli.gitcd 9n9s-cli
# Build with Gogo build -o 9n9s-cli ./cmd/9n9s-cli
# Installsudo mv 9n9s-cli /usr/local/bin/CLI Authentication
Section titled “CLI Authentication”After installation, authenticate the CLI with your 9n9s account:
# Login interactively9n9s-cli login
# Or set API key directlyexport NINES_API_KEY="your-api-key"
# Verify authentication9n9s-cli auth whoamiAPI Key Management:
- Go to Organization Settings > API Keys in your dashboard
- Click Create API Key
- Set permissions and scope for the key
- Copy the key and store it securely
- Use the key for CLI authentication
Docker Integration
Section titled “Docker Integration”Use 9n9s with containerized applications and services.
Docker Images
Section titled “Docker Images”Official Docker images are available for the CLI tool:
# Pull the latest CLI imagedocker pull 9n9s/cli:latest
# Use in a containerdocker run --rm -e NINES_API_KEY="your-api-key" 9n9s/cli:latest heartbeat pulse your-monitor-idDocker Compose Example
Section titled “Docker Compose Example”version: "3.8"
services: app: build: . environment: - NINES_HEARTBEAT_ID=your-monitor-id depends_on: - monitor-health
monitor-health: image: 9n9s/cli:latest environment: - NINES_API_KEY=${NINES_API_KEY} command: | sh -c ' while true; do sleep 300 9n9s-cli heartbeat pulse ${NINES_HEARTBEAT_ID} --message "Health check from container" done ' restart: unless-stoppedKubernetes Integration
Section titled “Kubernetes Integration”Deploy monitoring alongside your Kubernetes applications:
apiVersion: batch/v1kind: CronJobmetadata: name: health-monitorspec: schedule: "*/5 * * * *" # Every 5 minutes jobTemplate: spec: template: spec: containers: - name: health-check image: 9n9s/cli:latest env: - name: NINES_API_KEY valueFrom: secretKeyRef: name: monitoring-secrets key: api-key - name: NINES_HEARTBEAT_ID value: "your-monitor-id" command: - /bin/sh - -c - | # Check application health if kubectl get pods -l app=myapp --field-selector=status.phase=Running | grep -q myapp; then 9n9s-cli heartbeat pulse $NINES_HEARTBEAT_ID --message "Application pods healthy" else 9n9s-cli heartbeat pulse $NINES_HEARTBEAT_ID --fail --message "Application pods unhealthy" fi restartPolicy: OnFailureConfiguration as Code
Section titled “Configuration as Code”Set up Infrastructure as Code for your monitoring configuration.
Terraform Provider
Section titled “Terraform Provider”Install and configure the 9n9s Terraform provider:
terraform { required_providers { nines = { source = "9n9s-io/nines" version = "~> 1.0" } }}
provider "nines" { api_key = var.nines_api_key # Or use environment variable NINES_API_KEY}
# Example monitor configurationresource "nines_project" "production" { name = "Production Services" organization_id = var.organization_id}
resource "nines_heartbeat_monitor" "backup_job" { name = "Daily Database Backup" project_id = nines_project.production.id schedule = "0 2 * * *" grace_period = "1h" timezone = "UTC"
tags = { environment = "production" service = "database" criticality = "high" }}Pulumi Integration
Section titled “Pulumi Integration”Use Pulumi for TypeScript/Python Infrastructure as Code:
TypeScript:
import * as nines from "@9n9s/pulumi";
const project = new nines.Project("production", { name: "Production Services", organizationId: "your-org-id",});
const backupMonitor = new nines.HeartbeatMonitor("backup-job", { name: "Daily Database Backup", projectId: project.id, schedule: "0 2 * * *", gracePeriod: "1h", timezone: "UTC", tags: { environment: "production", service: "database", criticality: "high", },});Python:
import pulumi_nines as nines
project = nines.Project("production", name="Production Services", organization_id="your-org-id")
backup_monitor = nines.HeartbeatMonitor("backup-job", name="Daily Database Backup", project_id=project.id, schedule="0 2 * * *", grace_period="1h", timezone="UTC", tags={ "environment": "production", "service": "database", "criticality": "high" })YAML Configuration
Section titled “YAML Configuration”Use YAML files for simple configuration management:
api_version: v1kind: Configuration
projects: production-services: name: "Production Services" description: "Critical production infrastructure monitoring"
heartbeats: - name: "Daily Database Backup" schedule: "0 2 * * *" grace_period: "1h" timezone: "UTC" tags: environment: production service: database criticality: high
- name: "Log Rotation" schedule: "0 1 * * 0" # Weekly on Sunday grace_period: "30m" expected_runtime: min: "5m" max: "20m" tags: environment: production service: system criticality: medium
uptime: - name: "API Health Check" url: "https://api.example.com/health" frequency: "1m" assertions: - type: "STATUS_CODE" operator: "EQUALS" value: "200" - type: "RESPONSE_TIME" operator: "LESS_THAN" value: "1000" tags: environment: production service: api criticality: highApply the configuration:
# Preview changes9n9s-cli config diff --file 9n9s.yml
# Apply changes9n9s-cli config apply --file 9n9s.ymlEnvironment Variables
Section titled “Environment Variables”Configure 9n9s tools using environment variables:
# API Authenticationexport NINES_API_KEY="your-api-key"
# Default Organization/Projectexport NINES_ORGANIZATION_ID="your-org-id"export NINES_PROJECT_ID="your-project-id"
# CLI Configurationexport NINES_CONFIG_DIR="$HOME/.config/9n9s"export NINES_LOG_LEVEL="info" # debug, info, warn, error
# SDK Configurationexport NINES_TIMEOUT="10s"export NINES_RETRY_COUNT="3"export NINES_BASE_URL="https://api.9n9s.com" # For on-premise deploymentsVerification
Section titled “Verification”Verify your installation is working correctly:
Test SDK Installation
Section titled “Test SDK Installation”Python:
from nines import Ninesprint("9n9s Python SDK installed successfully!")
# Test connection (optional)nines = Nines("test-id")print(f"SDK version: {nines.version}")Node.js:
import { Nines } from "@9n9s/sdk";
console.log("9n9s Node.js SDK installed successfully!");
// Test connection (optional)const nines = new Nines("test-id");console.log(`SDK version: ${nines.version}`);Test CLI Installation
Section titled “Test CLI Installation”# Check version9n9s-cli version
# Test authentication9n9s-cli auth whoami
# List projects (requires authentication)9n9s-cli projects listTest Monitoring
Section titled “Test Monitoring”Create a test monitor and send a pulse:
# Create a test heartbeat monitorMONITOR_ID=$(9n9s-cli heartbeat create \ --name "Test Monitor" \ --schedule "every 5 minutes" \ --grace 300 \ --project-id "your-project-id" \ --output json | jq -r '.id')
# Send a test pulse9n9s-cli heartbeat pulse $MONITOR_ID --message "Test pulse from CLI"
# Check monitor status9n9s-cli heartbeat get $MONITOR_IDNext Steps
Section titled “Next Steps”Now that you have 9n9s installed and configured:
- Create your first monitor - Set up monitoring for a real service
- Configure alerts - Get notified when issues occur
- Set up team access - Invite team members and configure permissions
- Explore integrations - Connect with your existing tools and workflows
Troubleshooting
Section titled “Troubleshooting”Common Installation Issues
Section titled “Common Installation Issues”SDK Import Errors:
- Ensure you’re using the correct package name for your language
- Check that your Python/Node.js version meets minimum requirements
- Verify the SDK is installed in the correct environment/virtual environment
CLI Authentication Issues:
- Verify your API key has the correct permissions
- Check that the API key hasn’t expired
- Ensure you’re using the correct organization context
Network Connectivity:
- Verify you can reach
api.9n9s.comandpulse.9n9s.com - Check firewall rules and proxy settings
- Ensure TLS/SSL certificates are up to date
Permission Errors:
- Check that your API key has sufficient permissions for the operations you’re attempting
- Verify you have access to the specified organization and projects
- Contact your organization administrator if you need additional permissions
Getting Help
Section titled “Getting Help”- Documentation: docs.9n9s.com
- Community: GitHub Discussions
- Support: [email protected]
- Status Page: status.9n9s.com