Installation
Using Go Install
go install github.com/Aditya251610/pingify@latest
Using Git Clone
git clone https://github.com/Aditya251610/pingify.git
cd pingify
go build -o pingify
Using Docker
docker pull aditya251610/pingify:latest
Quick Start
Get started with Pingify in seconds. Monitor any API endpoint with real-time alerts and AI-powered analysis.
Basic Monitoring
pingify monitor https://api.example.com/health --interval 30s --threshold 500ms
This command monitors the API every 30 seconds and alerts if response time exceeds 500ms.
With Email Notifications
pingify monitor https://api.example.com/health --notify email --email your@email.com
Enable email notifications to get instant alerts when issues are detected.
Commands
Pingify provides a comprehensive set of commands for API monitoring, analysis, and notification management.
monitor
The core command for monitoring API endpoints with customizable intervals and thresholds.
Basic Usage
pingify monitor <URL> [flags]
Available Flags
--interval
Monitoring interval (default: 60s)
Examples: 30s, 1m, 5m
--threshold
Response time threshold (default: 1s)
Examples: 500ms, 2s, 5s
--timeout
Request timeout (default: 30s)
Maximum time to wait for response
--notify
Notification method
Options: email, discord, slack
Examples
Monitor with custom interval and threshold:
pingify monitor https://api.example.com/status --interval 15s --threshold 200ms
Monitor with email notifications:
pingify monitor https://api.example.com/health --notify email --email admin@company.com
Monitor with custom headers:
pingify monitor https://api.example.com/private --header "Authorization: Bearer token123"
ai
Get AI-powered analysis and suggestions for your API monitoring data using OpenAI.
Basic Usage
pingify ai [command] [flags]
Subcommands
Analyze recent monitoring data:
pingify ai analyze --logs pingify_logs.json
Get suggestions for performance issues:
pingify ai suggest --url https://api.example.com --issue slow-response
Explain monitoring results:
pingify ai explain --logs pingify_logs.json --last 24h
Note: AI features require an OpenAI API key. Set the OPENAI_API_KEY
environment variable.
logs
View and analyze structured JSON logs generated by Pingify monitoring.
Basic Usage
pingify logs [flags]
Examples
View recent logs:
pingify logs --tail 50
Filter logs by status:
pingify logs --status error --last 1h
Export logs to file:
pingify logs --export csv --output monitoring_report.csv
Log Structure
{
"timestamp": "2025-01-27T10:30:00Z",
"url": "https://api.example.com/health",
"status_code": 200,
"response_time": "245ms",
"success": true,
"error": null,
"headers": {
"content-type": "application/json"
}
}
notify
Configure notification settings for email, Discord, and Slack alerts.
Email Configuration
pingify notify email --smtp-host smtp.gmail.com --smtp-port 587 --email your@email.com
Discord Webhook
pingify notify discord --webhook https://discord.com/api/webhooks/...
Slack Integration
pingify notify slack --webhook https://hooks.slack.com/services/...
Test Notifications
pingify notify test --method email
Docker Usage
Run Pingify in a containerized environment for easy deployment and scaling.
Basic Docker Run
docker run -d --name pingify-monitor aditya251610/pingify:latest monitor https://api.example.com/health
With Environment Variables
docker run -d \
--name pingify-monitor \
-e OPENAI_API_KEY=your_openai_key \
-e SMTP_HOST=smtp.gmail.com \
-e SMTP_PORT=587 \
-e EMAIL_USER=your@email.com \
-e EMAIL_PASS=your_password \
aditya251610/pingify:latest monitor https://api.example.com/health --notify email
Docker Compose
version: '3.8'
services:
pingify:
image: aditya251610/pingify:latest
container_name: pingify-monitor
environment:
- OPENAI_API_KEY=your_openai_key
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- EMAIL_USER=your@email.com
- EMAIL_PASS=your_password
command: monitor https://api.example.com/health --notify email --interval 30s
restart: unless-stopped
volumes:
- ./logs:/app/logs
Configuration
Configure Pingify using environment variables or configuration files.
Environment Variables
OPENAI_API_KEY
OpenAI API key for AI features
SMTP_HOST
SMTP server hostname
SMTP_PORT
SMTP server port (default: 587)
EMAIL_USER
Email username for authentication
EMAIL_PASS
Email password or app password
LOG_LEVEL
Logging level (debug, info, warn, error)
Configuration File
Create a pingify.yaml
file in your project directory:
# Pingify Configuration
monitoring:
default_interval: "60s"
default_threshold: "1s"
default_timeout: "30s"
notifications:
email:
smtp_host: "smtp.gmail.com"
smtp_port: 587
from: "alerts@yourcompany.com"
to: ["admin@yourcompany.com"]
discord:
webhook_url: "https://discord.com/api/webhooks/..."
slack:
webhook_url: "https://hooks.slack.com/services/..."
ai:
openai_api_key: "your_openai_key"
model: "gpt-3.5-turbo"
logging:
level: "info"
file: "pingify_logs.json"
max_size: "100MB"
max_backups: 5
Contributing
We welcome contributions from the community! Here's how you can help improve Pingify.
Getting Started
# Fork the repository and clone it
git clone https://github.com/yourusername/pingify.git
cd pingify
# Create a new branch for your feature
git checkout -b feature/your-feature-name
# Install dependencies
go mod tidy
# Run tests
go test ./...
Development Guidelines
- Follow Go best practices and conventions
- Write comprehensive tests for new features
- Update documentation for any API changes
- Ensure backward compatibility when possible
Submitting Changes
# Commit your changes
git add .
git commit -m "feat: add new monitoring feature"
# Push to your fork
git push origin feature/your-feature-name
# Create a pull request on GitHub
License
Pingify is released under the MIT License. This means you can:
- Use it commercially
- Modify and distribute
- Use it privately
- Include in larger works
The full license text is available in the LICENSE file in the repository.