8 Replies Latest reply on Apr 6, 2017 6:02 PM by wlipford

    Creating a template, to monitor specific things?

    waqas.ahmed.bw

      Hey,

       

      I'm looking to make a template so we can monitor a group of devices, ie: just say the CPU load, or just say the disk load. We don't need to see every thing for every single device, but we'd like this relatively automated as well, to make it a bit easier to manage

       

      Does any one know of such a way?

       

       

       

      The product in question is the "Network Performance Monitor" I think I posted this in the right area

       

      Any help would be much appreciated.

       

      Thanks.

        • Re: Creating a template, to monitor specific things?
          d09h

          If you onboarded the devices via a Network Discovery, that functionality already exists to a certain extent.  During import, you can limit what you bring in.

           

          Automatically add discovered nodes

          check out steps 5, 8, and 9

           

          Automatically add discovered nodes

          Automatic monitoring means you do not have to go through the Discovery Import wizard every time you run a discovery. It is useful when you have configured your discovery to find similar nodes or network devices.

          1. Click Settings > Network Discovery, and add a discovery, or select an existing one and click Edit.
          2. Click through the Discovery Wizard to the Monitoring Settings page.
          3. Choose to include devices that only respond to ICMP (ping). If you decide to exclude devices that only respond to ICMP, your discovery list may be smaller than you expect and you must add those devices manually.
          4. On Monitor Settings, select Automatically monitor based on my, and click Define Monitoring Settings.
          5. Select the interfaces properties you want to apply to any discovered nodes and click Next. You can also create advanced filters for interfaces under Advanced selection options. This option is available for NPM.
          6. For switches, routers & firewalls, select Up trunk ports and wireless access ports.
          7. For servers, select Up interfaces.
          8. Use Advanced Filtering Options for existing interface descriptions to choose your most interesting ports, such as 'uplink', 'WAN', etc.
          9. Choose the types of volumes you want to monitor.
          1 of 1 people found this helpful
          • Re: Creating a template, to monitor specific things?
            d09h

            You can also limit what you view (this doesn't limit polling):

             

            Assign views by device type

            • Re: Creating a template, to monitor specific things?
              jvb

              You could do a couple things... One would be to add a custom resource to a page and use a filter to only show certain resources on certain nodes (screen shots below)

              You may also want to consider looking at Custom Properties to do more logical groupings on your devices.

              Create a custom property

               

              Click Customize Page in the upper right corner:

               

               

              Click the plus sign in one of the columns to add a resource:

               

              Use the search bar to find a resource, in this case I selected a particular CPU resource:

               

               

              That will result in a new resource / widget on your page which you can then edit:

               

              Then use the "Filter Nodes (SQL)" section to filter that resource (there are some examples included on the edit dialog):

               

              1 of 1 people found this helpful
                • Re: Creating a template, to monitor specific things?
                  wlipford

                  This is all good, but you would bring in everything and filter out on views. Not ideal with a large estate.

                  We have over 30k nodes in NPM, I am doing a import of 5000 right now, so I only want 3 interfaces per node and I can't bring everything in.

                    • Re: Creating a template, to monitor specific things?
                      jvb

                      wlipford... In that situation (unless I am misunderstanding you) you would want to limit what gets pulled in

                      using the "Interfaces" section of the discovery results. That way you don't have to filter out resources you didn't wish to monitor in the first place.

                      As you can see below it is possible to specifically select or ignore interfaces.

                      1 of 1 people found this helpful
                        • Re: Creating a template, to monitor specific things?
                          wlipford

                          exactly, and when you are doing thousands of devices then selecting what interfaces to ignore is very cumbersome. I guess what I was really griping about is the fact that the system doesn't have a way to set reg-ex templates of some sort. It is also VERY annoying that you can't exclude devices from being imported into NPM. It just adds another step of my automation scripts going back and removing them from NCM.

                           

                          My workaround was basically to let the discovery complete, then go into the discovery results and change the up/down status of the interface based on my pearl regex routines, then simply select all UP interfaces and import. Not ideal and subject to breaking if anything gets changed in the DB schema for Discovery.

                            • Re: Creating a template, to monitor specific things?
                              wlipford

                              #!/usr/local/bin/perl

                              use strict;

                              use Net::SNMP;

                              use GenericODBC;

                               

                              #my $profile =   $ARGV[0];

                              my $profile    = 'Lipford - Testing';

                              my $search     = $ARGV[1];

                              my $pattern    = $ARGV[2];

                              my $outfile    = "Log$ARGV[0].txt";

                              my $dbusername = '######';

                              my $dbpassword = '######';

                              my $server     = '#######';

                              my $database   = 'SolarwindsOrion';

                               

                              if ((! $ARGV[1]) || ($ARGV[1] !~ /(uplink|alias)/i)) {

                              print "\n\nUsage: perl UpdateDiscovery.pl <Discovery Name> <(UpLink or Alias)> [Interface Description (Only if Alias)]  \n";

                              exit;

                              }

                               

                               

                              my $db = new GenericODBC;

                              $db->connect($server,$database,$dbusername,$dbpassword);

                               

                              if ($ARGV[1] =~ /Uplink/i)

                                  {

                                      open (LOG, ">$outfile");

                                      my $profileID = prepDisco($profile);       

                                      my @nodes = getNodes($profileID, 2);

                                      &byMacCount($profileID,@nodes);

                                  }

                              elsif ($ARGV[1] =~ /Alias/i)

                                  {

                                      exit if (!$ARGV[2]);

                                      open (LOG, ">$outfile");

                                      my $profileID = prepDisco($profile);       

                                      my @nodes = getNodes($profileID, 1);

                                      &byDescription($profileID,@nodes);

                               

                                  }

                                  close LOG;

                               

                               

                               

                              sub prepDisco

                              {

                                  #get profileID from name

                                  my $profileName = shift;

                                  print "Short Profile Name is $profileName\n";

                                  my $profileSql = "select ProfileID as ID,Name as name from [DiscoveryProfiles] where Name like '%$profileName%'";

                                  #print "get profile name sql:\n$profileSql\n\n";

                                  my $profile = $db->select($profileSql);

                                  if (! $profile->{ID})

                                  {

                                      print "Profile $profileName does not exist in Orion Database $database\n";

                                      exit;

                                  }

                                  #set all interfaces in the profile to down

                                  my $prepSql = "update DiscoveryPhysicalInterfaces set OperatingStatus = 'down' where ProfileID = '$profile->{ID}'";

                                  $db->update($prepSql);

                                  return $profile;

                              }

                               

                              sub getNodes

                              {

                                  #get device and interface information for polling

                                  my ($profileName, $type) = @_;

                                  if ($type == 1)

                                  {

                                      my $sql = "select Distinct [DiscoveryNodes].PrimaryAddress as IP,

                                      [DiscoverySNMPCredentials].CommunityString as Community,

                                      [DiscoveryPhysicalInterfaces].IfIndex as IfIndex,

                                      [DiscoveryPhysicalInterfaces].InterfaceID as InterfaceID,

                                      [DiscoveryNodes].NodeId as NodeID,

                                      [DiscoveryProfiles].ProfileID as ProfileID,

                                      [DiscoveryProfiles].Name as ProfileName

                                      from

                                      DiscoveryNodes

                                      join DiscoveryNodeCredentials on

                                      [DiscoveryNodes].NodeID = [DiscoveryNodeCredentials].NodeID

                                      join DiscoverySNMPCredentials on

                                      [DiscoveryNodeCredentials].CredentialsID = [DiscoverySNMPCredentials].CredentialsID

                                      join DiscoveryPhysicalInterfaces on

                                      [DiscoveryPhysicalInterfaces].NodeID = [DiscoveryNodes].NodeID

                                      join DiscoveryProfiles on [DiscoveryProfiles].ProfileID = [DiscoveryNodes].ProfileID

                                      where [DiscoveryProfiles].Name = '$profileName->{name}' order by NodeID";

                                      print "Using Profile $profileName->{name}\n";

                                      my @nodes = $db->select($sql);

                                      return @nodes;

                                  }

                                  elsif ($type == 2)

                                  {

                                      my $sql = "select Distinct [DiscoveryNodes].PrimaryAddress as IP,

                                      [DiscoverySNMPCredentials].CommunityString as Community,

                                      [DiscoveryNodes].NodeId as NodeID,

                                      [DiscoveryProfiles].ProfileID as ProfileID,

                                      [DiscoveryProfiles].Name as ProfileName

                                      from

                                      DiscoveryNodes

                                      join DiscoveryNodeCredentials on

                                      [DiscoveryNodes].NodeID = [DiscoveryNodeCredentials].NodeID

                                      join DiscoverySNMPCredentials on

                                      [DiscoveryNodeCredentials].CredentialsID = [DiscoverySNMPCredentials].CredentialsID

                                      join DiscoveryProfiles on [DiscoveryProfiles].ProfileID = [DiscoveryNodes].ProfileID

                                      where [DiscoveryProfiles].Name = '$profileName->{name}' order by NodeID";

                                      print "Using Profile $profileName->{name}\n";

                                      my @nodes = $db->select($sql);

                                      return @nodes;

                                  }

                               

                               

                               

                              }

                              sub byDescription

                              {

                                 

                                  my ($profileID, @nodes) = @_ ;

                               

                                  #Fill out the IfxAlias field and mark the interface "up" in the Discovery Interfaces Table

                                  foreach my $node (@nodes) {

                                      print LOG "_________________________________________\n";

                                      print LOG "$node->{IP}\n";

                                      print LOG "$node->{NodeID}\n";

                                      print LOG "$node->{Community}\n";

                                      print LOG "$node->{IfIndex}\n";

                                      my $alias = getAlias($node->{IP},$node->{Community},$node->{IfIndex});

                                      print LOG "Description is $alias\n";

                                      print LOG "_________________________________________\n";

                                      if ($alias =~ /$pattern/i)

                                      {

                                      my $updatesql = "update DiscoveryPhysicalInterfaces set IfxDescription = '$alias',OperatingStatus = 'up' where NodeID = '$node->{NodeID}' and InterfaceID = '$node->{InterfaceID}' and IfIndex = '$node->{IfIndex}' and ProfileID = '$profileID->{ID}'";

                                      print LOG "Update SQL is $updatesql\n";

                                          $db->update($updatesql);

                                      }

                                  }

                              }

                               

                              sub byMacCount

                              {

                                  my ($profileID, @nodes) = @_ ;

                                  foreach my $node (@nodes)

                                  {

                                      print "Working on node $node->{IP}\n";

                                      print "Running c:/Program Files (x86)/SolarWinds/ToolSet/SWSPMCMD.exe $node->{IP} $node->{Community} $node->{IP} $node->{Community} /nologo /nostatus\n";

                                      my @result = `\"c:/Program Files (x86)/SolarWinds/ToolSet/SWSPMCMD.exe\" $node->{IP} $node->{Community} $node->{IP} $node->{Community} /nologo /nostatus`;

                                      my $ifindex;

                                      my $macCount = 0;

                                      foreach (@result)

                                      {

                               

                                          next if($macCount > 2);

                                          #print "Line =  $_\n";

                                          if ($_ =~ /if\:(\d+)/)

                                          {

                                              $ifindex = $1;

                                              $macCount = 0;

                               

                                          }

                                          elsif ($_ =~ /MAC\:/)

                                          {

                                              $macCount += 1;

                                          }

                                          if ($macCount > 2)

                                          {

                                              my $updatesql = "update DiscoveryPhysicalInterfaces set OperatingStatus = 'up' where NodeID = '$node->{NodeID}' and IfIndex = '$ifindex' and ProfileID = '$profileID->{ID}'";

                                              print LOG "Update SQL is $updatesql\n";

                               

                                              $db->update($updatesql);

                                              next;

                               

                                          }

                                      }

                                  }

                              }

                               

                              sub getAlias

                              {

                                 my ($IP,$Community,$IfIndex) = @_;

                                 my $OID_IfAlias = "1.3.6.1.2.1.31.1.1.1.18.$IfIndex";

                               

                                 my ($session, $error) = Net::SNMP->session(

                                    -hostname  => shift || "$IP",

                                    -community => shift || "$Community",

                                 );

                               

                                 if (!defined $session) {

                                    next;

                                 }

                               

                                 my $result = $session->get_request(-varbindlist => [ $OID_IfAlias ],);

                               

                                 if (!defined $result) {

                                    $session->close();

                                    next;

                                 }

                               

                                 #print "The IfAlias for Interface $IfIndex is $result->{$OID_IfAlias}\n";

                               

                                 $session->close();

                               

                                 return $result->{$OID_IfAlias};

                              }