Cobotium Monitoring Guide
This guide provides detailed instructions for setting up comprehensive monitoring for your Cobotium token program on the Solana blockchain.
Introduction
Monitoring your Cobotium token program is essential for:
- Ensuring the program is functioning correctly
- Detecting suspicious activity
- Responding quickly to issues
- Gathering usage statistics
- Planning for future upgrades
This guide will help you set up a comprehensive monitoring system for your Cobotium deployment.
Basic Monitoring Setup
Transaction Monitoring
The simplest way to monitor your program is using the Solana CLI:
solana logs --url https://api.mainnet-beta.solana.com <PROGRAM_ID>
This will stream all logs related to your program. You can redirect this output to a file for later analysis:
solana logs --url https://api.mainnet-beta.solana.com <PROGRAM_ID> > cobotium_logs.txt
Creating a Simple Monitoring Script
Here's a simple bash script to monitor your program and send alerts:
#!/bin/bash
PROGRAM_ID="your_program_id_here"
EMAIL="your_email@example.com"
DISCORD_WEBHOOK="your_discord_webhook_url"
# Monitor logs
solana logs --url https://api.mainnet-beta.solana.com $PROGRAM_ID | while read line; do
echo "$line" >> cobotium_logs.txt
# Check for important events
if [[ $line == *"Instruction: FreezeAccount"* ]]; then
echo "ALERT: Account freeze detected!" | mail -s "Cobotium Alert" $EMAIL
curl -H "Content-Type: application/json" -d '{"content": "ALERT: Account freeze detected!"}' $DISCORD_WEBHOOK
fi
if [[ $line == *"Error"* ]]; then
echo "ALERT: Error detected in program!" | mail -s "Cobotium Alert" $EMAIL
curl -H "Content-Type: application/json" -d '{"content": "ALERT: Error detected in program!"}' $DISCORD_WEBHOOK
fi
done
Save this as monitor.sh
, make it executable with chmod +x monitor.sh
, and run it in the background with nohup ./monitor.sh &
.
Advanced Monitoring
For production environments, you'll want a more robust monitoring solution.
Setting Up a Dedicated Monitoring Server
-
Provision a dedicated server (e.g., AWS EC2, DigitalOcean Droplet)
-
Install necessary dependencies:
apt-get update apt-get install -y nodejs npm python3 python3-pip pip3 install solana npm install -g pm2
-
Use our provided monitoring script:
git clone https://github.com/arodrig125/Cobotium-cli.git cd Cobotium-cli/monitoring npm install ./setup.sh
Integration with Monitoring Services
Prometheus and Grafana Setup
Our monitoring system includes a Prometheus exporter that exposes metrics about your Cobotium program. To set up Prometheus and Grafana:
-
Install Prometheus:
wget https://github.com/prometheus/prometheus/releases/download/v2.37.0/prometheus-2.37.0.linux-amd64.tar.gz tar xvfz prometheus-2.37.0.linux-amd64.tar.gz cd prometheus-2.37.0.linux-amd64/
-
Create a Prometheus config file:
# prometheus.yml global: scrape_interval: 15s scrape_configs: - job_name: 'cobotium' static_configs: - targets: ['localhost:9090'] - job_name: 'solana' static_configs: - targets: ['localhost:8899']
-
Install Grafana:
apt-get install -y apt-transport-https software-properties-common wget -q -O - https://packages.grafana.com/gpg.key | apt-key add - echo "deb https://packages.grafana.com/oss/deb stable main" | tee -a /etc/apt/sources.list.d/grafana.list apt-get update apt-get install -y grafana systemctl enable grafana-server systemctl start grafana-server
Alerting
Setting Up Alerts
Configure alerts for various scenarios:
High Transaction Volume
Alert when transaction volume exceeds normal levels, which could indicate:
- Increased adoption (positive)
- Potential attack (negative)
Error Rate
Alert when error rate exceeds a threshold, which could indicate:
- Program bugs
- Network issues
- Malicious activity
Large Transfers
Alert on unusually large token transfers, which could indicate:
- Whale activity
- Potential theft
Freeze Events
Always alert on freeze/thaw events, as these are administrative actions.
Alert Channels
Set up multiple alert channels for redundancy:
- SMS
- Discord/Slack
- PagerDuty (for critical alerts)
Dashboard Setup
Create a monitoring dashboard using Grafana:
- Log in to Grafana (default: http://your-server-ip:3000)
- Add Prometheus as a data source
- Create a new dashboard with panels for:
- Account count
- Transaction volume
- Error rate
- Token supply
- Recent freeze events
- Program health status
A sample Grafana dashboard configuration is available in the monitoring/grafana
directory of the Cobotium repository.
Emergency Response
Prepare an Emergency Response Plan
-
Define Severity Levels:
- Level 1: Minor issues (e.g., occasional errors)
- Level 2: Moderate issues (e.g., increased error rate)
- Level 3: Critical issues (e.g., potential exploit)
-
Response Team:
- Assign roles and responsibilities
- Create an on-call schedule
- Establish communication channels
-
Response Procedures:
- For Level 3 incidents, consider using the freeze functionality
- Document steps for common scenarios
- Create recovery procedures
Emergency Actions
In case of a critical security incident:
-
Freeze affected accounts using:
cobotium-cli --program-id <PROGRAM_ID> freeze-account --account <ACCOUNT_ADDRESS> --mint <MINT_ADDRESS> --freeze-authority <FREEZE_AUTH_KEYPAIR>
-
Notify users through:
- Website (cobotium.io)
- Social media
- Investigate the incident while accounts are frozen
- Implement fixes and thaw accounts when safe