Skip to content

qeratos/ProxMox_API_Esp8266

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProxMox_API_Esp8266

Description

This project aimed to interaction between ESP8266 And ProxMox virtualization environment. Here used main API of ProxMox Documentation.

How to use

  1. You need to create ProxMox User for your device.
  2. Generate API secret key and API-Username.
  3. Download this code and copy to your project directory.
  4. Install Aditional libraries from Library Manager in ArduinoIDE. You also can install them manualy.

Dependences

  1. ESP8266HTTPClient
  2. ESP8266WiFi
  3. Arduino_JSON

Installation

  1. Download repo to your PC.
  2. Unzip it to your work directory.
  3. Include file in your code.

Example

#include "ProxMoxer.hpp"  // Include library class
#define MachinesCount 2
ProxMoxer proxmox("ESP API-USername", "API-Secret-key", "https://ProxMoxIP:8006", MachinesCount);  
/*
* Create a server object at "https://ProxMoxIP:8006"
* With the generated API key "API-Secret-key" and API-Username "ESP API-USername"
* Machines quantity equal to 2
*/

void setup(){
  proxmox.SetNodeParams(0, 100, "pve"); // Set parameters for the machine with ID 100: node name "pve" and serial number 0 for access to machine from the library
}

void loop(){
  proxmox.GetNodeState(0); // Recieve status data from current node. Returned object of  Node structure
}

Node Structure example

struct Node{
    int VMID = 100;          // Machine ID 
    String NodeName = "pve"; // Node name
    String MachineName = "", // Machine name 
            Tags = "";       // Different tags
    int OSType = 0,          // OS type
        Status = 0,          // Status
        PID = 0,             // Machine PID
        CPU = 0,             // CPU count
        DISK = 0,            // Disk space
        MEM = 0;             // Ram space
};

Creating API User and Key

1. Goto Datacenter tab. Next to Permissions and to Users

Users Tab

2. Create new user for api. It better than use your root for all activities.

Users Tab

- Give user name and other setting like in screenshoot.

3. Create Token. It must be your secret key.

Users Tab

- Move to `API Tokens` tab. Select user which you create and give it ID. - You must write it somwhere because you not be able to see it again.

4. Add token permissions.

Users Tab

- For all activites which this library gives you, select administrator role for this API token.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages