LiquidObject

Bulk disabling modules in LibreNMS

So I was in the process of adding in a large quantity of devices into LibreNMS but noticed a few days later the discovery and polling times were getting longer. Not really to be unexpected as there was more devices but some devices took an abnormally amount of time to finish the SNMP scans. Below is an example how to bulk disable attributes under LibreNMS (likely to work on Observium as well).

Outside of globally disabling different modules we will need to talk directly to the MySQL database in order to accomplish what we are looking for.

In the below example I’m looking at disabling the discover_arp-table on all Windows hosts.

select device_id,hostname from devices where OS = 'windows';

Then copy and paste the results into your favorite editor (I generally use excel for data like this).

="insert into devices_attribs (device_id,attrib_type,attrib_value) values ("""&A2&""",""discover_arp-table"",""0"");"

In the above the “A” column contains all the device_id’s I wish to adjust.

This will generate MySQL insert statements like the below

insert into devices_attribs (device_id,attrib_type,attrib_value) values ("4","discover_arp-table","0");

At this point all you need to do is run the generated MySQL statements against the LibreNMS database to disable the given module in bulk.

, ,
October 27, 2014 at 12:06 pm Comments (0)

Filtering out extra Windows interfaces when monitoring with LibreNMS/Observium

By default when monitoring a Windows-based host with LibreNMS (also for Observium), you’ll see a lot of extra unwanted interfaces present. However, to filter them out globally you need to edit the config.php file. Here’s a basic config that should take of most of the extra network adapters present for Windows Server 2008 through 2012R2. Notice, if you have special teaming configurations they will create their own unique names which this will not remove.

$config['bad_if'][] = "wan miniport (sstp)";
$config['bad_if'][] = "wan miniport (l2tp)";
$config['bad_if'][] = "wan miniport (pptp)";
$config['bad_if'][] = "wan miniport (pppoe)";
$config['bad_if'][] = "wan miniport (ipv6)";
$config['bad_if'][] = "wan miniport (network monitor)";
$config['bad_if'][] = "wan miniport (ip)";
$config['bad_if'][] = "wan miniport (ikev2)";
$config['bad_if'][] = "tap-windows adapter v9";
$config['bad_if'][] = "broadcom netlink (tm) gigabit ethernet-wfp lightweight filter-0000";
$config['bad_if'][] = "software loopback interface 1";
$config['bad_if'][] = "lo";
$config['bad_if'][] = "vmxnet3 ethernet adapter-wfp lightweight filter-0000";
$config["bad_if"][] = "vmxnet3 ethernet adapter #2-wfp lightweight filter-0000";
$config['bad_if'][] = "ras async adapter";
$config["bad_if"][] = "teredo tunneling pseudo-interface";
$config["bad_if"][] = "microsoft kernel debug network adapter";
$config["bad_if"][] = "vmxnet3 ethernet adapter-wfp native mac layer lightweight filter-0000";
$config["bad_if"][] = "vmxnet3 ethernet adapter-wfp 802.3 mac layer lightweight filter-0000";
$config["bad_if"][] = "wan miniport(ip)-wfp native mac layer lightweight filter-0000";

I’ve also included a few specifically if you are running on VMware with the VMXNet3 network adapter.

,
October 20, 2014 at 10:05 am Comments (0)

Mass enabling windows features via PowerShell

Recently I needed to add the SNMP service to a few hundred systems. There are few more involved methods for this via unattended installs with SCCM or batch scripted GPO-linked entries but if you want a quick and easy way how, try the below.

Target OS: Server 2008, 2008R2, 2012 and 2012R2

Source system was a 2012R2 box with the AD and ServerManager PowerShell modules installed

Import-Module ActiveDirectory
$myservers = Get-ADComputer -SearchBase "OU=My Servers,DC=liquidobject,DC=com" -Filter "*"
foreach($i in $myservers)
{
 $mysession = New-PSSession -ComputerName $i.name
 Invoke-Command -Session $mysession {Import-Module Servermanager}
 Invoke-Command -Session $mysession {Add-WindowsFeature SNMP-Service}
}

Any server in the OU offline or running an unsupported os (ie Server 2003….we all have them) will throw an error. The above is pretty basic example on how you can install any Windows feature remotely. The remote PSSession and Invoke-Command methods allow you to perform any supported PowerShell command remotely.

In the event your running a legacy version of Windows, there are still options available. The limitation of the below is that it requires you to login to the given system and run the command with an administrative command prompt.

servermanagercmd.exe -install snmp-service
logout
, , , , ,
October 16, 2014 at 1:59 pm Comments (0)