Issues (2963)

includes/html/pages/device/apps/proxmox.inc.php (1 issue)

1
<?php
2
3
/*
4
 * Copyright (C) 2015 Mark Schouten <[email protected]>
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; version 2 dated June,
9
 * 1991.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * See https://www.gnu.org/licenses/gpl.txt for the full license
17
 */
18
19
include 'includes/html/application/proxmox.inc.php';
20
21
if (! \LibreNMS\Config::get('enable_proxmox')) {
22
    print_error('Proxmox agent was discovered on this host. Please enable Proxmox in your config.');
23
} else {
24
    $graphs = [
25
        'proxmox_traffic'       => 'Traffic',
26
    ];
27
28
    foreach (proxmox_node_vms(var_get('device')) as $nvm) {
0 ignored issues
show
var_get('device') of type boolean|string is incompatible with the type integer expected by parameter $n of proxmox_node_vms(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

28
    foreach (proxmox_node_vms(/** @scrutinizer ignore-type */ var_get('device')) as $nvm) {
Loading history...
29
        $vm = proxmox_vm_info($nvm['vmid'], $nvm['cluster']);
30
31
        foreach ($vm['ports'] as $port) {
32
            foreach ($graphs as $key => $text) {
33
                $graph_type = 'proxmox_traffic';
34
35
                $graph_array['height'] = '100';
36
                $graph_array['width'] = '215';
37
                $graph_array['to'] = \LibreNMS\Config::get('time.now');
38
                $graph_array['id'] = $vm['app_id'];
39
                $graph_array['device_id'] = $vm['device_id'];
40
                $graph_array['type'] = 'application_' . $key;
41
                $graph_array['port'] = $port['port'];
42
                $graph_array['vmid'] = $vm['vmid'];
43
                $graph_array['cluster'] = $vm['cluster'];
44
                $graph_array['hostname'] = $vm['description'];
45
46
                echo '<h3>' . $text . ' ' . $port['port'] . '@' . $vm['description'] . '</h3>';
47
48
                echo "<tr bgcolor='$row_colour'><td colspan=5>";
49
50
                include 'includes/html/print-graphrow.inc.php';
51
52
                echo '</td></tr>';
53
            }
54
        }
55
    }
56
}
57