Skip to content

Commit

Permalink
Merge pull request #4052 from florianbeer/proxmox
Browse files Browse the repository at this point in the history
Add snmp polling capability for Proxmox
  • Loading branch information
laf committed Aug 17, 2016
2 parents de0b55c + a61c1b2 commit 1e565db
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/Extensions/Applications.md
Expand Up @@ -14,6 +14,7 @@ Different applications support a variety of ways collect data: by direct connect
8. [DHCP Stats](#dhcp-stats) - extend SNMP
9. [Memcached](#memcached) - extend SNMP
10. [Unbound](#unbound) - Agent
11. [Proxmox](#proxmos) - extend SNMP


* [Agent Setup](#agent-setup)
Expand Down Expand Up @@ -186,6 +187,16 @@ server:

Restart your unbound after changing the configuration,v erify it is working by running /usr/lib/check_mk_agent/local/unbound.sh

### Proxmox
1. Download the script onto the desired host (the host must be added to LibreNMS devices)
`wget https://github.com/librenms/librenms-agent/blob/master/agent-local/proxmox -o /usr/local/bin/proxmox`
2. Make the script executable: `chmod +x /usr/local/proxmox`
3. Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add:
`extend proxmox /usr/local/bin/proxmox`
(Note: if your snmpd doesn't run as root, you might have to invoke the script using sudo. `extend proxmox /usr/bin/sudo /usr/local/bin/proxmox`)
4. Restart snmpd on your host
5. On the device page in Librenms, edit your host and check `Proxmox` on the Applications tab.

Agent Setup
-----------

Expand Down
9 changes: 9 additions & 0 deletions includes/polling/applications/proxmox.inc.php
Expand Up @@ -40,6 +40,15 @@ function proxmox_vm_exists($i, $c, &$pmxcache) {

if (isset($config['enable_proxmox']) && $config['enable_proxmox'] && !empty($agent_data['app'][$name])) {
$proxmox = $agent_data['app'][$name];
} elseif (isset($config['enable_proxmox']) && $config['enable_proxmox']) {
$options = '-O qv';
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.7.112.114.111.120.109.111.120';
$proxmox = snmp_get($device, $oid, $options);
$proxmox = preg_replace('/^.+\n/', '', $proxmox);
$proxmox = str_replace("<<<app-proxmox>>>\n", '', $proxmox);
}

if ($proxmox) {
$pmxlines = explode("\n", $proxmox);
$pmxcluster = array_shift($pmxlines);
dbUpdate(array('device_id' => $device['device_id'], 'app_type' => $name, 'app_instance' => $pmxcluster),
Expand Down

0 comments on commit 1e565db

Please sign in to comment.