Monitoring Your Container Deployments with HCS

HostSpace's HCS provides a comprehensive UI for managing and monitoring your containerized applications without needing to use the command line. Here’s how you can set up and use monitoring features via the HCS UI:

Step-by-Step Guide for Monitoring Deployments on HCS

  1. Access the Metrics Section

    • Log in to your HCS account.

    • Navigate to your dashboard and select the project/deployment you want to monitor.

    • Go to the "Metrics" section within your selected deployment.

  2. Enable Monitoring

    • Ensure that monitoring is enabled for your deployment. This might involve toggling a switch or setting up monitoring configurations provided by HCS.

  3. Set Up Monitoring Tools

Using Grafana and Prometheus

Grafana Configuration:

  • Install Grafana: Ensure Grafana is installed and running.

  • Add Prometheus as a Data Source:

    • Open Grafana, navigate to Configuration > Data Sources.

    • Click on "Add data source" and select "Prometheus."

    • Enter the URL of your Prometheus server, e.g., http://prometheus-server:9090.

    • Save and test the data source to ensure connectivity.

  • Create Dashboards:

    • Go to Dashboards > New Dashboard.

    • Add panels to the dashboard to visualize key metrics like CPU usage, memory usage, disk I/O, and application-specific metrics.

    • Customize the panels to show real-time data and set appropriate time ranges for better visibility.

Prometheus Configuration:

  • Set Up Prometheus:

    • Ensure Prometheus is installed and configured to scrape metrics from your deployment.

    • Add HCS endpoints to Prometheus' scrape configuration, typically in the prometheus.yml file.

    • Example configuration:

      yamlCopy codescrape_configs:
        - job_name: 'hcs-metrics'
          static_configs:
            - targets: ['<your-hcs-endpoint>']
  • Define Alerting Rules:

    • Create alerting rules in the prometheus.yml file to trigger alerts based on specific metric thresholds.

    • Example alerting rule:

      yamlCopy codegroups:
        - name: hcs-alerts
          rules:
            - alert: HighCPUUsage
              expr: sum(rate(container_cpu_usage_seconds_total[1m])) by (instance) > 0.8
              for: 2m
              labels:
                severity: critical
              annotations:
                summary: "High CPU usage detected on {{ $labels.instance }}"
                description: "CPU usage has exceeded 80% for more than 2 minutes."
  1. Configure Metrics Collection

    • Use HCS built-in metrics exporters or deploy additional exporters to collect necessary metrics from your deployment.

    • Ensure that metrics such as CPU usage, memory usage, disk I/O, and network traffic are being collected.

  2. Set Up Alerts

    • Grafana Alerting:

      • Navigate to Alerting > Notification Channels in Grafana.

      • Add a new notification channel, specifying your preferred method (email, Slack, etc.).

      • Create alert rules within your dashboards and link them to the notification channel.

    • Prometheus Alerting:

      • Configure alert manager in Prometheus to handle alert notifications.

      • Example configuration:

        yamlCopy codeglobal:
          resolve_timeout: 5m
        
        route:
          receiver: 'email'
        
        receivers:
          - name: 'email'
            email_configs:
              - to: 'your-email@example.com'
  3. Visualize Metrics

    • In Grafana, customize your dashboards to provide a comprehensive view of your deployment’s health.

    • Organize panels by different aspects of your deployments, such as resource utilization, application performance, and service health.

  4. Advanced Operations

Resource Operations

  • Access the "Resource Operations" section in HCS to manage operations like scaling, restarting, or stopping the deployment as needed.

Scheduled Tasks

  • Set up scheduled tasks in the "Scheduled Tasks" section for automated operations and maintenance activities.

Webhooks

  • Configure webhooks in the "Webhooks" section to trigger actions or notifications based on deployment events.

Last updated