File size: 536 Bytes
c70b233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
   const axios = require('axios');

   const PROXMOX_API_URL = 'https://your-proxmox-server:8006/api2/json';
   const AUTH_TOKEN = 'PVEAPIToken=yourToken';

   async function fetchVmData() {
     try {
       const response = await axios.get(`${PROXMOX_API_URL}/nodes/yourNode/qemu`, {
         headers: { Authorization: AUTH_TOKEN },
       });
       return response.data;
     } catch (error) {
       console.error('Error fetching VM data from Proxmox:', error);
       return null;
     }
   }

   module.exports = { fetchVmData };