Introduction to LinkVigil
Monitoring the status of API endpoints is crucial for maintaining the health and performance of your applications. LinkVigil offers a straightforward and efficient solution to keep track of your API endpoints and post their statuses to Atlassian Statuspage. This tool simplifies the monitoring process, providing real-time updates and seamless integration with Statuspage.
Overview of LinkVigil
LinkVigil is designed to provide an easy-to-use interface for monitoring API endpoints. It checks the status of these endpoints and updates Atlassian Statuspage accordingly. Whether you’re managing a small project or a large enterprise system, LinkVigil helps ensure that you stay informed about the status of your APIs.
Key Features
- Real-Time Monitoring: Constantly checks the status of specified API endpoints.
- Integration with Atlassian Statuspage: Automatically updates Statuspage based on the status of your endpoints.
- Customizable Settings: Easily configure endpoints and monitoring settings through a YAML file.
- Debug Mode: Run the application in debug mode to test configurations without making actual API calls to Statuspage.
Understanding API Monitoring
Monitoring APIs is vital to ensure that your services are running smoothly and efficiently. Without proper monitoring, issues can go unnoticed until they affect end-users, potentially causing significant downtime and loss of revenue.
Importance of API Monitoring
API monitoring helps detect issues early, allowing you to address them before they escalate. It ensures that your services remain available and performant, providing a better experience for your users.
Common API Issues
- Downtime: APIs may become unavailable due to server issues, network problems, or maintenance.
- Slow Response Times: High response times can indicate performance bottlenecks or server overload.
- Incorrect Responses: APIs may return incorrect data or errors due to bugs or misconfigurations.
How LinkVigil Enhances API Monitoring
LinkVigil takes the hassle out of monitoring your API endpoints. By automating the status checks and updates to Atlassian Statuspage, it ensures that you are always aware of the current state of your APIs.
Real-Time Status Updates
LinkVigil continuously monitors your API endpoints, providing real-time updates on their status. This ensures that any issues are detected and reported immediately.
Seamless Integration with Atlassian Statuspage
By integrating with Atlassian Statuspage, LinkVigil automatically posts status updates based on the condition of your API endpoints. This keeps your status page up-to-date without any manual intervention.
Setting Up LinkVigil
Setting up LinkVigil is straightforward. Follow the steps below to get started.
Download Binary
The binary can be downloaded directly from the GitHub releases page. Stenstromen/linkvigil/releases
Compile Binary from source
Prerequisites
Before you begin, ensure that you have the following:
- A valid API key for Atlassian Statuspage.
- Go programming language installed on your system.
Environment Variables
Set the STATUSPAGE_API_KEY environment variable with your Statuspage API key.
export STATUSPAGE_API_KEY=your-api-key
Settings File Configuration
Create a settings file to define the endpoints you want to monitor. Refer to endpoints.example.yaml
for an example configuration.
- name: API Backend
type: "status"
url: "https://api.example.com/status"
page_id: "page_id"
component_id: "component_id"
Building and Running LinkVigil
Once your environment is set up and the settings file is configured, you can build and run LinkVigil.
Building the Application
Navigate to the directory where you have LinkVigil’s source code and run:
go build .
This will compile the application into a binary.
Running the Binary
Run the binary with the path to your endpoints YAML file as an argument. Optionally, you can add “debug” as an argument to run in debug mode.
./linkvigil /path/to/endpoints.yaml
For debug mode:
./linkvigil /path/to/endpoints.yaml debug
Debugging and Troubleshooting
LinkVigil includes a debug mode to help you test your configurations without making actual API calls to Statuspage.
Debug Mode
In debug mode, LinkVigil will check the status of your endpoints and log the results without updating Statuspage. This is useful for verifying your settings.
Common Issues and Solutions
- Invalid API Key: Ensure that the STATUSPAGE_API_KEY is set correctly.
- Configuration Errors: Double-check your YAML configuration file for syntax errors.
- Network Issues: Verify that your endpoints are reachable and that there are no network problems.
Using LinkVigil with Systemd on Linux
To run LinkVigil as a service on Linux, follow these steps to set up a systemd service.
Downloading the Binary
Download the latest release of the LinkVigil binary and place it in /usr/local/bin
.
Creating a Systemd Service
Create a systemd service file in /etc/systemd/system/linkvigil.service
.
[Unit]
Description=LinkVigil
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/linkvigil
[Service]
WorkingDirectory=/usr/local/
User=linkvigil
Group=linkvigil
EnvironmentFile=/etc/default/linkvigil
ExecStart=/usr/local/bin/linkvigil /etc/linkvigil.yaml 2>&1 | logger -t linkvigil
Restart=always
TasksMax=infinity
TimeoutStopSec=infinity
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
Configuring the Service
- Create a user and group for the service.
sudo useradd -r -s /bin/false linkvigil
- Change ownership of the binary.
chown linkvigil: /usr/local/bin/linkvigil
- Add the API key to
/etc/default/linkvigil
.
STATUSPAGE_API_KEY=your-api-key
- Enable and start the service.
sudo systemctl enable linkvigil --now
Metrics and Thresholds in LinkVigil
LinkVigil monitors various metrics and uses predefined thresholds to determine the status of your endpoints.
Monitoring Metrics
- Response Status: Checks if the API returns a 200 status code.
- Response Time: Measures the response time of the API.
- Error Status: Detects 500 status codes and other errors.
Action Thresholds
Event | Action |
---|---|
Endpoint Respond Status 200 | Post Status Operational |
Endpoint Response Time Above 500ms | Post Status Degraded |
Endpoint Respond Status 500 | Post Status Major Outage |
Endpoint Not Responding | Post Status Major Outage |
Any Other Response Status | Info Log Endpoint And HTTP Status |
Creating and Using Configuration Files
LinkVigil uses YAML configuration files to define the endpoints it monitors. Below is an example configuration file.
- name: API Backend
type: "status"
url: "https://api.example.com/status"
page_id: "page_id"
component_id: "component_id"
Customizing Your Configuration
You can customize the configuration to monitor different endpoints and adjust settings as needed.