Introduction to Network Management Tools Scotty.

xiaoxiao2021-03-06  82

Network management is one of the important techniques of web applications. Currently, network management tools under Linux mainly include MON system management tools, PIKT fault detection tools, Scotty network management tools, MRTG, CMU-SNMP SNMP tools, and more. Among them, Scotty is a network management software development kit developed by the Technical University of Braunschweig Network Management Group (NMG). The development package is a TCL / TK script language extension library written in C language. Because of its powerful, it is often used to quickly establish network management applications. Under UNIX / Linux, Scotty is known as one of the standard network management programs and development packs, and many operating systems have been integrated directly.

Scotty uses TCL / TK script languages. TCL is a very versatile scripting language, which was originally implemented by John K.SousterHout in UNIX, and later gradually added the graphics toolkit TK. TCL / TK now can be run under many platforms, so programs written with TCL can be very simple to port from one platform to another. TCL / TK mainly includes two parts: language itself and library. The TCL is also a library package that can be embedded in the application, and the TCL itself can be expanded. For example, TNM in Scotty is a TCL extension library, in addition to this, other TCL extensions such as Expect. While developing with Scotty, you can also match these libraries, making the development code multiplexing, and system stability is better. TCL has now become an industry-wide scripting configuration language, including famous companies such as Motorola, Sun, Cisco, and TCLs are used according to their needs. For example, the Cisco router uses TCL to configure, more particularly, where Cisco also applies Scotty as assistance. It can be seen that using TCL and Scotty development network management applications are in line with industry standards. On the Scotty homepage, some tools written in Scotty are also available on SNMP applications developed by Scotty on the famous open source website SourceForge. The source code is only a few hundred lines.

Scotty's 2.x version is a stable version except for the Windows version, while the current 3.0alpha version is also developed. 3.0 Mainly provided support for SNMPv3, and there is also a package of several network advanced applications. SCOTTY generally includes two parts: one is TNM TCL extension. This extension provides access to network management information resources. Its two is the Tkined network editor. The editor provides a set of frames for the scalable network management system.

The advantages of using Scotty development network applications are faster development, can be executed across platforms, and modifying code does not need to be recompiled, and their source code is also open. As a developing package designed for network management, we can easily manipulate various network objects flexibly in Scotty. Scotty's TNM extension has now supported many protocols, as follows (in parentheses for specific support details for this protocol):

1. SNMP (SNMPv1, SNMPV

2C

, SNMPv2u, and you can access the MIB)

2. ICMP (Echo), Mask, Timestamp, UDP / ICMP Routing Request)

3. DNS (A, PTR, Hinfo, MX, SOA RECORD LOOKUPS)

4. HTTP (server side and client)

5. Sun RPC (Portmapper, Mount, Rstat, EtherSTAT, PCNFS Service) 6. NTP (version 3 mode 6 request)

7. UDP (send and receive UDP datagram - currently not implemented channels)

In addition, it also adds commands to simplify the implementation of the network management program:

1. The Netdb command allows access to this example network database (hostname and IP address, service name and service number, network name, protocol name, sun rpc service name)

2. The syslog command allows information to be sent to the local system log device

3. The JOB command simplifies the implementation of the detection and control process that needs to be scheduled with specific intervals.

In addition to TNM, Scotty also provides an interactive network editor tkined. Its main function is to provide an interactive interface for the network program. This manager is programmable and can be controlled by TNM, which can be controlled to all details of the editor because the development package provides the corresponding TCL API. In this way, we can write applications directly through TNM, and we provide an interactive interface by our own, or you can develop through TNM with Tkined integration framework. This also reflects SCOTTY powerful flexibility.

Many programs that use high-level languages ​​to dozens of lines of code can be implemented in Scotty. For example, you want to convert a network address to the host name Simply execute the Netdb Hosts Name Address command. And this is a long string of code in C. So, many Scotty applications seem to be relatively short, but actually achieved some complicated functions.

Similarly, there are some shortcomings using Scotty. The first is the defects of the scripting language, the processing difference of complex data structure and algorithm, and its numerical processing power is also very poor, this is introduced in front scripting language and system advanced language, so it is not suitable for developing large complexity application. Second, since Scotty itself is designed to simplify development, TNM hides the details of the underlying layer. If the development of the application needs to design a lot of underlying operations, it is generally not suitable for Scotty.

One of the simple programs below is taken from the sample code of Scotty 3.0, and the comment portion is slightly removed, and it can be seen from which Scotty's approximate use.

Package Require TNM 3.0

Namespace Import TNM :: MIB TNM :: SNMP TNM :: ICMP TNM :: Netdb

Proc Traphandler {ip PDU args} {

SET MSG "$ PDU from $ IP:"

Foreach VB $ args {

Append MSG "[TNM :: MIB Name [LINDEX $ VB 0]] = /" [LINDEX $ VB 2] / ""

}

PUTS stdout $ msg

TNM :: Syslog Warning $ msg

}

PROC TRY CMD {

IF {[Catch $ CMD MSG]} {PUTS stderr "$ cmd failed: $ msg"}

}

Try {TNM :: SNMP Listener -Version SNMPV1}

Try {TNM :: SNMP Listener -Version SNMPV

2C

}

Try {TNM :: SNMP Listener -Version SNMPv3}

Foreach s [tnm :: snmp find] {

$ s bind trap "traphandler% a% T% V"

}

Vwait Forever

The main function of the above program is to hook the Traphandler procedure to specify the SNMP trap processing, which will automatically call the process when the SNMP trap datag is received. It can be seen that the syntax of TCL is very similar to C, which greatly improves the development speed. As can be seen from the above analysis, Scotty is a relatively mature network management application development package, which is mainly used to develop some small applications. When making your own development, you can choose according to actual needs.

转载请注明原文地址:https://www.9cbs.com/read-107813.html

New Post(0)