SNMP scanning

Marcin Pelzner November 27, 2017

Hi :)

Is there a posibility to scan via SNMP Linux hosts, and gather more informaction (similar level of information scanned like SSH)?

2 answers

0 votes
Marcin Pelzner March 6, 2018

Hi

I am writing a pattern, can you take a look? Also got a question. How ExtendedValues for SNMP shoes in JIRA Insigiht? Can I define to collect the data in a custom Insight atribute?

<?xml version="1.0" encoding="utf-8"?>
<!--
© Riada Development AB
v 3.0.0
-->
<ScanPattern xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<PatternID>UNITEAM-Cust-SNMP-1</PatternID>
<OrderNr>0</OrderNr>
<ProcessType>SNMP_GET</ProcessType>
<PatternType>SNMPExtendedValues</PatternType>
<Command>
<![CDATA[
1.3.6.1.4.1.9.9.46.1.2.1.1.2
]]>
</Command>
<Processing>
<![CDATA[
using System;
using Insight.Discovery.Tools;
using Insight.Discovery.InfoClasses;
using System.Collections.Generic;

namespace Insight.Discovery {
public class PatternExec {
public List<ExtendedInformation> PerformAction(object[] parameters)
{
if (parameters[0] == null) return null;

List<ExtendedInformation> ret = null;
List<ExtendedInformation> input = null;

try
{
LogService.Instance.LogDebug("Command: " + (parameters[1]).ToString().Trim());

input = (List<ExtendedInformation>)parameters[0];

ret = new List<ExtendedInformation>();

foreach (ExtendedInformation item in input)
{
LogService.Instance.LogDebug("Result for: " + item.Name + " = " + item.Value);
ExtendedInformation extInfo = null;

try
{
extInfo = new ExtendedInformation()
{
Name = "managementDomainName",
Value = input.Value.ToString()
};
}
catch (Exception ex)
{ LogService.Instance.LogDebug("Error Value is wrong", ex); }
if (extInfo != null)
{
ret.Add(extInfo);
}
}
}
catch (Exception ex)
{ LogService.Instance.LogDebug("Error getting Extendet SNMP RAM Informations", ex); }
finally
{
if (input != null)
input = null;
}
return ret;
}
}
}
]]>
</Processing>
</ScanPattern>
Christian_Solle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2018

Hi,

here a fixed perfomeaction method:

(sorry that platform is not good to post code snipets, maybe you will/can create support tickets at our portal for requesting custom pattern support in future)

And yes you can map the result to an attribute (of course)

place a result file that containing the extended information in the import folder,

go to the import configuration and the drop down will show up the exetendet information as locator: in that case "managementDomainName"

 

public List<ExtendedInformation> PerformAction(object[] parameters)
{
if (parameters[0] == null) return null;

List<ExtendedInformation> ret = null;
List<ExtendedInformation> input = null;

try
{
LogService.Instance.LogDebug("Command: " + (parameters[1]).ToString().Trim());

input = (List<ExtendedInformation>)parameters[0];

ret = new List<ExtendedInformation>();

foreach (ExtendedInformation item in input)
{
LogService.Instance.LogDebug("Result for: " + item.Name + " = " + item.Value);
ExtendedInformation extInfo = null;

if (item.Name == "1.3.6.1.4.1.9.9.46.1.2.1.1.2")
{
try
{
extInfo = new ExtendedInformation()
{
Name = "managementDomainName",
Value = item.Value.ToString()
};
}
catch (Exception ex)
{ LogService.Instance.LogDebug("Error Value is wrong", ex); }
if (extInfo != null)
{
if (ret.IsNullOrEmpty())
ret = new List<ExtendedInformation>();
ret.Add(extInfo);
}
}
}
}
catch (Exception ex)
{ LogService.Instance.LogDebug("Error getting Extendet SNMP RAM Informations", ex); }
finally
{
if (input != null)
input = null;
}
return ret;
}

0 votes
Christian_Solle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2017

Hi Marcin,

you can install SNMP to an Linux system.

But you will not get that information details like running the ssh commands.

Maybe it will be possible to write Mib packages to get all that informations but that are out of my expertise.

// Christian

Marcin Pelzner December 7, 2017

1. What about Windows?

2. Can a serial number be obtained via SNMP scan (for standard devices)?

Christian_Solle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2017

Hi Marcin,

that is the same answer.

I don't know if there is a Mib package available for Windows

that provides that information.

// Christian

Marcin Pelzner January 24, 2018

Hi again, Chris. :)

Can someone help me with these mib packages? Or can you suggest how can I learn it? Is it complex? Will it be doable to configure it on XXX machines in a finite time? Any information will be helpful.

Thanks :)

Christian_Solle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2018

Hi Marcin,

we only can help to create custom pattern if you have Mib Number with results etc.

As I wrote that we don't know if SNMP packages for Windows are available

(I think there will be) but you need to do that research and installing/configuration

by your own. We only cover the part to discover data and managing the data

not to enable systems to delivering data.

 

// Christian

Marcin Pelzner January 26, 2018

Ok, can you tell me if I understand correctly:

If I would like to use mib on Linux I need to install the Insight Discovery on the Linux machine that I have the mib packages, right? So the snmp will use them.

Christian_Solle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2018

No, that is not correct.

If you want to use SNMP you need to install an SNMP Demon on that host

(doesn't matter if Linux or Windows)

The Discovery-Tool can run anywhere else

it will use the SNMP Protocol to collect data from the server via SNMP.

But always keep in mind SNMP will deliver less information.

You should always prioritize the other protocols (SSH, WMI, Powershell)

 

// Christian

Marcin Pelzner January 26, 2018

But Insight Discovery can collect data without any agent/Deamon via SNMP. Does the MIB packeges requier agent/Deamon?

We won't be able to scan via SSH and WMI unfortunately.

And MIB can help us access more information about routers, switches etc. information.

Christian_Solle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2018

Hmm but maybe it would be good to get at first some information about what SNMP is and how it works.

https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol

https://en.wikipedia.org/wiki/Management_information_base

 

To collect data from a Host via SNMP needs of course something at the server that will delivering that informations. So yes on servers you need to install something.

Most NetworkDevices like Switches, Routers etc. have SNMP out of the box but not server.

// Christian

Marcin Pelzner January 26, 2018

Ok, these I have, host doesn't bother me. The mib files does. Do these need to be imported on the server that is a scanner?

Christian_Solle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2018

 

But you want to collect information from hosts (server)?

The Mib's doesn't need to be "imported" on the server that is running the Discovery-Tool

In the Pattern-Files are described which OID delivering which information.

// Christian

Marcin Pelzner January 26, 2018

Yes I want to collect information from hosts that are configured for SNMP scan. Infrastructure is already using MIB and doing their custom scans, and I get information that MIB has to be configured on "side of scanning device". And now I wonder, how to tell Insight Disovery to use these MIB scanning via SNMP.

Now the information from Windows and Linux hosts are basic.

Christian_Solle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2018

You can take a look to the SNMP Pattern files that are delivered in the package

our take a look to our documentation :)

https://documentation.riada.se/insight-discovery/latest/discovery-documentation/set-up-discovery/patterns

3.1 describes how SNMP Pattern working

 

// Christian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events