SNM How to ...

... monitor using ping
... monitor using snmp
... error on updating file
... create an e-mail alert
... split one device across multiple menus
... configure using multiple target and graph files
... monitor a frame relay device
... stop the images from caching on IIS
... send multiple e-mails
... ignore invalid input values
... run multiple instances of SNM
... create a language set for SNM

A collection of information, tips and answers to questions to improve the operation of SNM

  1. Two methods are available for monitoring a device using ping:

    1. To use the ping functionality built into SNM:
      • In the config file, delete or comment out <ping_file>path\ping_file</ping_file>
      • In the config file, set <timeout>5</timeout> as appropriate
      • In a template in the target file, set ping=ping_count as appropriate
    2. To use ping provided by the Operating System:
      • In the config file, set <ping_file>path\ping_file</ping_file> as appropriate
      • In the config file, set <timeout>5</timeout> as appropriate
      • In a template in the target file, set ping=ping_count as appropriate
  2. Add the target to the graph file
  3. Stop, then run SNM in test mode to validate
  4. Start SNM
  5. View the results after allowing 2 * frequency time to pass
For further information, refer to: SNM Configuration and Operation Guide
  1. Ensure the snmp agent on the device is active. Use Getif on Win32 or net-snmp on Linux to verify this.
  2. Determine what you intend to monitor.
  3. Add new templates and interfaces to the target file as required.
  4. Add the target to the graph file
  5. Stop, then run SNM in test mode to validate
  6. Start SNM
  7. View the results after allowing 2 * frequency time to pass
For further information, refer to: SNM Configuration and Operation Guide

If an interface configuration is changed, an error may occur.

Example: insertData|Error on updating file:/path/target/template.rrd:unknown DS name 'ds?'

To resolve this simply delete the rrd file in question and SNM will automatically re-create it including repair the error when the target is next queried.

To send e-mail alerts when a query fails or does not meet a user defined criteria:

  1. Configure <mail_server> and <mail_from> in the configuration file (config.xml)
  2. Configure <alert> in the target file (target.xml)
  3. Optionally configure criteria in <int_alert> in the target file (target.xml)

Note1: <alert>     - is triggered when the target fails to respond to a (ping, snmp or script) query. Configuration is only required for e-mail alerting.
Note2: <int_alert> - is triggered when a query result does not meet a criteria. Configuration is required to set the criteria.

For further information, refer to: SNM Configuration and Operation Guide

Question:

Is it possible to have the same target mentioned in different menus, using different templates and/or interfaces?
Example:

  • Switch1 int 1 in the menu RouterConnections
  • Switch1 int 49 and 50 in the menu FiberConnections
  • Switch1 int 10 till 20 in the menu ServerConnections

Answer:

This can be achieved by numerous configurations. One example is by setting up one target with all interfaces included, then using the graph file to configure different menus.

For this, the target file would be:

   <target id="Switch1" ...>
     <template ...
       <interface int=1 ... />
       <interface int=49 ... />
       <interface int=50 ... />
       <interface int=10 ... />
       ...
       <interface int=20 ... />
     </template>
   </target>

And the graph file would be:

   <page menu="Site 1:RouterConnections:Switch1" description="Switch1 RouterConnections">
     <graph ...
       <plot int=1 ... />
     </graph>
   </page>
   <page menu="Site 1:FiberConnections:Switch1" description="Switch1 FiberConnections">
     <graph ...
       <plot int=49 ... />
       <plot int=50 ... />
     </graph>
   </page>
   <page menu="Site 1:ServerConnections:Switch1" description="Switch1 ServerConnections">
     <graph ...
       <plot int=10 ... />
       ...
       <plot int=20 ... />
     </graph>
   </page>
 

Question:

I have many targets and graphs, is it possible to have these configured over multiple files?

Answer:

This can be achieved by using XML Entity declarations in the targets.xml and graphs.xml files.

Example: targets.xml file would be:

<?xml version="1.0"?> 
<!-- refer to: readme.html or http://snm.sourceforge.net/operate.html
     for details on configuring this file. --> 
<!DOCTYPE targets [
  <!-- ______________Servers______________ --> 
  <!ENTITY server1 SYSTEM "file://C:/Program%20Files/snm/targets/server1.xml"> 
  <!ENTITY proxy2  SYSTEM "file://C:/Program%20Files/snm/targets/proxy2.xml"> 
  <!-- ______________Switches______________ --> 
  <!ENTITY switch02 SYSTEM "file://C:/Program%20Files/snm/targets/switch02.xml"> 
  <!ENTITY switch03 SYSTEM "file://C:/Program%20Files/snm/targets/switch03.xml"> 
  <!ENTITY switch04 SYSTEM "file://C:/Program%20Files/snm/targets/switch04.xml"> 
]> 
<targets> 
  <!-- ______________Servers______________ --> 
  &server1;
  &proxy2;
  <!-- ______________Switches______________ --> 
  &switch02;
  &switch03;
  &switch04;
</targets> 

and an example target file: C:/Program Files/snm/targets/switch02.xml would be:

<!-- ______________Switch02______________ --> 
<target id="Switch02" ip_address="10.1.1.11" community="public" alert="2u:someone@example.com"> 
  <template id="ping" ping="4" data_source_type="GAUGE" /> 
  <template id="ifUsage" oid="1.3.6.1.2.1.2.2.1.int" data_source_type="COUNTER" frequency="300"> 
    <interface int="10.101" description="interface 01 ifInOctet" input_max="1.25e6" input_min="0" /> 
    <interface int="10.102" description="interface 02 ifInOctet" input_max="1.25e6" input_min="0" /> 
    <interface int="10.103" description="interface 03 ifInOctet" input_max="1.25e6" input_min="0" /> 
    <interface int="10.104" description="interface 04 ifInOctet" input_max="1.25e6" input_min="0" /> 
  </template> 
</target> 

Also: graphs.xml file would be:

   <?xml version="1.0"?> 
   <!-- refer to: readme.html or http://snm.sourceforge.net/operate.html
        for details on configuring this file. --> 
   <!DOCTYPE graphs [
     <!-- ______________Servers______________ --> 
     <!ENTITY server1 SYSTEM "file://C:/Program%20Files/snm/graphs/server1.xml"> 
     <!ENTITY proxy2  SYSTEM "file://C:/Program%20Files/snm/graphs/proxy2.xml"> 
     <!-- ______________Switches______________ --> 
     <!ENTITY switch02 SYSTEM "file://C:/Program%20Files/snm/graphs/switch02.xml"> 
     <!ENTITY switch03 SYSTEM "file://C:/Program%20Files/snm/graphs/switch03.xml"> 
     <!ENTITY switch04 SYSTEM "file://C:/Program%20Files/snm/graphs/switch04.xml"> 
   ]> 
   <graphs> 
     <!-- ______________Servers______________ --> 
     &server1;
     &proxy2;
     <!-- ______________Switches______________ --> 
     &switch02;
     &switch03;
     &switch04;
   </graphs> 

and an example graph file: C:/Program Files/snm/targets/switch02.xml would be:

<!-- ______________Switch02______________ --> 
<page menu="Switch:Switch02" description="Graphs for device: Switch02"> 
  <graph description="ping" vertical_label="msec" short_label="msec"
         comment="test" graph_min="0" k_base="1000" number_format="fixed"> 
    <plot plot="AREA" color="cccccc" description="ping max">[Switch02:ping:max:MAX]</plot> 
    <plot plot="AREA" color="ffffff" description="ping min">[Switch02:ping:min:MAX]</plot> 
    <plot plot="LINE2" color="000000" description="ping avg">[Switch02:ping:avg:MAX]</plot> 
  </graph> 
  <graph description="Network Usage int. 1" vertical_label="bit/sec" short_label="bit/s"
         graph_min="0" k_base="1000"> 
    <plot plot="LINE2" color="0000EE" description="OutOctets">
          [Switch02:ifUsage:10.101:MAX],8,*</plot> 
    <plot plot="LINE2" color="006666" description="InOctets ">
          [Switch02:ifUsage:16.101:MAX],8,*</plot> 
    <plot plot="AREA"  color="EEEE00" description="InDiscard">
          [Switch02:ifErrors:13.101:AVERAGE]</plot> 
  </graph> 
</page>
 

Question:

I need to monitor frame relay services.
Can I monitor interfaces AND subinterfaces in SNM?
Here is an example of a snmpwalk from a cisco router:

  • 1.3.6.1.2.1.10.32.2.1.4.4.85 : Counter: 0
  • 1.3.6.1.2.1.10.32.2.1.4.4.90 : Counter: 0
  • 1.3.6.1.2.1.10.32.2.1.4.6.101 : Counter: 0
  • 1.3.6.1.2.1.10.32.2.1.4.6.105 : Counter: 0

Answer:

SNM can monitor interfaces and subinterfaces.
Simply add the interface and subinterface into the <int> in the targets file.
Example:

   <interface int=4.85 ... />

Refer to the template "framerelay_errors" in the templates.xml file where a RFC1315 Frame Relay FECN/BECM template is configured.

Question:

The autorefresh doesn't seem to work correctly (I need to press F5 to get a refresh). Is there something missing in my setup?

Answer:

To stop IIS caching the rrd images (allows the images in browsers to refresh each 5 minutes)

  • Goto Internet Information Services using the MMC: Administrative Tools >>  Internet Services Manager
  • In the 'Default Web Site', right click the 'snm' folder >> Properties >> HTTP Headers
  • Select 'Enable Content Expiration' and 'Expire Immediately'
     

Note: To date, this issue has only been observed in IIS

To send e-mail alerts to multiple recipients, separate each e-mail address in targets.xml by a ; or , (no spaces)

   Example: <alert>2:snm@example.com;second_snm@example.com</alert>
 

Question:

Each time a target restarts the SNM graphs show a value beyond that valid, eg: iis_web_hits returns 600+ million hits/min when IIS is restarted. Is there anyway to ignore the invalid values?

Answer:

If <input_min> and/or <input_max> are defined in the targets file, any value outside the defined range will be ignored.

For further information, refer to: SNM Configuration and Operation Guide

Question:

Can I run multiple instances of SNM?

Answer:

Yes, multiple instances can be run. To configure this:

  • Install 2 (or more) instances of SNM in differing directories, eg: /snm1 and /snm2
  • Ensure each <web_dir> is unique.
  • Ensure each <targetfile> is unique.
  • Ensure each <templatefile> is unique.
  • Ensure each <alert_file> is unique.
  • Ensure each <log_file> is unique.
  • If running as a service on win32, ensure the service names are unique, eg: snm1 and snm2
 

Currently, the internationalization of SNM is focused on ISO 8859-1 (Latin) languages. If interest is sufficient, 8859-x and UTF-8 (Unicode) will be investigated.

For Win32 users using a non-English language in SNM, the command prompt window will not display extended characters ( e.g. in 8859-1 ) properly. This is a problem with Windows console and not Perl or SNM.

Assuming a console running in a window (as opposed to running full-screen) then two things are required:
1. The default raster font used for console windows doesn't know about 8859-1 / latin-1, so change it. Use the system menu, Properties and select "Lucida Console" instead of "Raster Fonts".
2. Use the CHCP command to select the 1252 (Latin 1) codepage: CHCP 1252
Now re-run SNM in console mode and you should see the correct extended characters.

The following files define a SNM language set:

   \Program Files\snm\lang\xx.pm
   \inetpub\wwwroot\snm\lang\xx.pm
   \inetpub\wwwroot\snm\lang\xx\xx_alert.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_attribute.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_footer.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_header.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_log.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_status.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_target.htmt

Where xx is the language code in accordance with rfc3066

Language is configured in config.xml, example: <language language="en" />

The files:

   \Program Files\snm\lang\xx.pm
   \inetpub\wwwroot\snm\lang\xx.pm

are used by the perl module: Locale::Maketext.

The structure of these files is:

   package lang::es; 
   use strict;
   use warnings;
   use base qw(lang);
   use vars qw(%Lexicon);
   our $VERSION = '3.00';
   %Lexicon = (
   '_AUTO' =>
    1, # Default language will be used if an attribute is missing or fails
   # lexicon key => lexicon value,
   "translate" => "traduzir",
   "lexicon in SNM" => "lxico en SNM",
   ...
   );
   1;

To create a file, copy an existing file then:

  • modify lang::xx; in line 1,
  • modify the "lexicon value" in each "lexicon" (do not modify the "lexicon key")

The files:

   \inetpub\wwwroot\snm\lang\xx\xx_alert.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_attribute.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_footer.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_header.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_log.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_status.htmt
   \inetpub\wwwroot\snm\lang\xx\xx_target.htmt

are used to build XHTML files.

To create these files, copy existing files then:

  • In xx_header.htmt, ensure lang declaration is configured, e.g. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  • In xx_header.htmt, ensure charset declaration is configured, e.g. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  • In all htmt files, ensure include statements are configured correctly, e.g. <TMPL_INCLUDE NAME="lang/fr/fr_header.htmt">
  • In all htmt files, review all text, translating displayed text as appropriate

The four XML files (config.xml, targets.xml, graphs.xml and discover.xml) also require internationalization:
Ensure the charset is correctly declared, example: <?xml version="1.0" encoding="ISO-8859-1"?>