Skip to content

telexintegrations/Windows_Server_Health_Checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windows Server Health Checker

This project is a FastAPI-based application that connects to a Windows Server using SSH and retrieves various health metrics such as CPU usage, memory usage, disk usage, and network usage. The results are then sent to Telex.

Table of Contents

Features

  • Connects to a Windows Server using SSH
  • Retrieves CPU usage, memory usage, disk usage, and network usage
  • Sends the results to a specified channel on Telex
  • Asynchronous processing using FastAPI and BackgroundTasks

Requirements

  • Python 3.8+
  • FastAPI
  • Paramiko
  • HTTPX
  • Pytest (for testing)

Periquisites

  • Create a Telex account
  • Create an organization
  • Create a channel
  • Note channel ID

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/Windows_Server_Health_Checker.git
    cd Windows_Server_Health_Checker
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  3. Install the dependencies:

    pip install -r requirements.txt

Usage

  1. Run the FastAPI application:

    uvicorn main:app --reload
  2. Add /integration to your integrations on Telex:

    add_integration_to_telex

    NB: /integration should return a json as seen below

         {
         "date": {
                 "created_at": "2025-02-18",
                 "updated_at": "2025-02-18"
             },
             "descriptions": {
                 "app_name": "Windows Server Health Checker",
                 "app_description": "Monitor the performance of a Windows Server",
                 "app_logo": "https://i.imgur.com/bRoRB1Y.png",
                 "app_url": "base_url",
                 "background_color": "#fff"
             },
             "is_active": false,
             "integration_type": "interval",
             "key_features": [
                 "- Monitor the performance of a Windows Server",
                 "- NB: This integration is only for Windows Servers"
                 "- NB: Ensure that SSH is enabled on the Windows Server"
             ],
             "integration_category": "Monitoring & Logging",
             "author": "Chidubem Nwabuisi",
             "website": "base_url",
             "settings": [
                 {
                     "label": "Server_IP",
                     "type": "text",
                     "required": true,
                     "default": "",
                 },
                 {
                     "label": "username",
                     "type": "text",
                     "required": true,
                     "default": "",
                 },
                 {
                     "label": "password",
                     "type": "text",
                     "required": true,
                     "default": "",
                 },
                 {
                     "label": "interval",
                     "type": "text",
                     "required": true,
                     "default": "* * * * *",
                 }
             ],
             "tick_url": "<host_base_url>/api/v1/health",
     }
    
  3. Send a POST request to the /api/v1/health endpoint to test integration to call to Telex:

    You can use tools like curl, Postman, or any HTTP client to send a POST request to the /health endpoint with the required payload.

    Example payload:

    {
    	"channel_id": "telex_channel_id",
    	"return_url": "https://ping.telex.im/v1/return/<telex-channel-id>",
    	"settings": [
    		{
    			"label": "server_ip",
    			"type": "string",
    			"required": true,
    			"default": "127.0.0.1"
    		},
    		{
    			"label": "username",
    			"type": "string",
    			"required": true,
    			"default": "your_username"
    		},
    		{
    			"label": "password",
    			"type": "string",
    			"required": true,
    			"default": "your_password"
    		},
    		{
    			"label": "interval",
    			"type": "text",
    			"required": true,
    			"default": "* * * * *"
    		}
    	]
    }

    On Telex you should expect the following response upon successful connection to the server Telex Successful integration

If there are problems while connecting to the server, you will get notified on Telex as seen below Error Messages from Telex

Testing

  1. Ensure SSH is installed on the windows server. Follow guide here
  2. Ensure Windows Server is on the same network with you.
  3. Alternatively you can setup a windows server on any Virtualbox or VMware then test locally.
  4. Ensure user has administrative privileges.

Deployment

  1. Deployement was done to render.com for HTTPs communication

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages