This project aimed to interaction between ESP8266 And ProxMox virtualization environment. Here used main API of ProxMox Documentation.
- You need to create ProxMox User for your device.
- Generate API secret key and API-Username.
- Download this code and copy to your project directory.
- Install Aditional libraries from Library Manager in ArduinoIDE. You also can install them manualy.
- Download repo to your PC.
- Unzip it to your work directory.
- Include file in your code.
#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
}
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
};