System administration

Tcl is heavily used in the realm of system administration. Various resources and tools are described below.

Description

Cameron Laird had this to say (regarding a Tcl vs Perl for Sys Admin question) in comp.lang.tcl:

When people set up these bake-offs, I usually turn away; it's just too easy for Perl to dominate in the obvious "check-box" items.

Tcl Advocacy

In all the "Is {Java,Erlang,PHP,...} better than {C++,Rexx,Ada,...} for {Web scripting,COM automation,...}?" competitions, one of the easiest correct conclusions to draw is that Tcl is the single most essential and desirable language for cross-platform system administration. Here's why:

  • Expect is a Tcl extension. Expect is absolutely crucial for SysAd. Perl has an Expect.pm--but it's about a decade (slight exaggeration) behind the original Expect in its polish.
  • Tk is a Tcl extension. Again, Perl has Perl/Tk, but the latter has serious flaws on the Windows side.
  • Tcl glues better than Perl. Specifically, it's a lot easier to teach newcomers how to manage external processes with Tcl than with Perl. Some Perlites will argue this point. I've been studying it for a long time. I'm right.
  • Tcl Blend works. The Java/Perl combinations mostly don't.
  • Tcl has the strongest tradition of use as a testing language. Is the pertinence of that to SysAd clear?
  • Naive users take to Tcl at least as quickly as to Perl.

I don't put too much weight on this proposition. Season to taste, or, more specifically, apply as appropriate in your own situation.

notable system administration products using Tcl

Oracle Enterprise Manager
Websphere Control Program
scripting is done in Tcl
Vignette
StoryServer templates were defined in Tcl
Software AG's Graphical Installation for Unix
BMC Patrol installation GUI

See Also

Expect
automate and control interactive programs. Includes other useful utilities such as autoexpect, bgpasswd,
Modules
provides for the dynamic modification of a user's environment via modulefiles
A tiny URL extractor
What groups are shared by these users?
How can I calculate how much disk space is being used in a directory
snort
SMC
starfish
outlog - Taking care of log rotations automagically
failsh
pass_gen
tcl -mq , by Alexandros Stergiakis
POSIX Message Queues for Tcl. This extension provides a Tcl interface to POSIX Message Queues. It allows scripts to create/open/close/unlink multiple parallel message queues, and to send/receive messages synchronously and asynchronously to/from them. GPL license.
tcl-inotify , by Alexandros Stergiakis
File -system notification service for Tcl. This is a Tcl extension that provides an interface to the inotify file system notification service of the Linux kernel. GPL license.
tcl-pam , by Alexandros Stergiakis
PAM Authentication for Tcl. This project provides a Tcl interface to Pluggable Authentication Modules as implemented in Linux. It implements a Tcl package that exports the client -side functionality of PAM to the Tcl programming language. This allows Tcl scripts to use PAM for authentication. GPL license.
tcl -syslog
Syslog interface for Tcl. This project provides a Tcl interface to the standard *nix syslog service. It implements a Tcl package that exports the full functionality of the underlying syslog facility to the Tcl programming language. This includes local and remote logging. GPL license.
tcl -snmptools
Tcl SNMP tools for managing remote agents. This is a Tcl package that provides SNMP tools for managing remote Agents. It uses the NetSNMP library and supports all standard SNMP v1/v2/v3 operations and more: get, set, getnext, walk, bulkget, bulkwalk, trap, translate and table. GPL license
tBar
displays system status in a compact, easily-readable form. It features different widgets that can be arranged and colored using a provided configuration file.
OASYS
Object-oriented Adaptors to SYStem interfaces. A C++ library that provides a set of wrapper classes and utilities for systems programming projects. Includes Tcl shell bindings.

Monitoring Log Files

OK, it's true: there's a hole in the Tcl-SysAd story, and it has to do with logging--SysLog and such.

Tcllib seems like a natural place to build a plug for this hole. And some solutions exists at syslog.


LV: One thing that I'd love to find is some code to deal with monitoring log files. Log files come in many varieties, but in most cases, what one wants when monitoring would involve:

  • notification when something appeared in the log
  • optionally - statistics on how frequently certain key phrases have appeared in this log
  • able to dynamically handle when a log rotation occurs
  • able to alert in some manner when a serious entry appears
  • able to handle plain text logs or html formatted logs
  • ability to browse log files, and interactively creating filters to hide data that isn't currently relevant.

Right now (and I mean that literally) I would love to have something like this to go through event log files on Windows.

Another useful tool that I would love to find would grunge through the variety of log files on a system (on Windows, for example, the tracing logs, the event logs, the IIS logs, etc.) and generate a report concerning items of potential concern.

Misc

Another issue for system administration - how to roll Tcl out to your site.

Some of the issues to consider:

  • Does your operating system already come with Tcl?
  • If so, then are you satisfied with waiting on updates from the vendor, or do you need to install newer (or older) versions to get around problems or add new features?
  • If you are going install your own version, how do you do so in a manner that prevents a) current vendor utilities from breaking as you update Tcl, b) damage to your tcl installation when the operating system is patched or updated
  • How many versions of Tcl (or extensions) will you keep online at one time?
  • How are you going to handle updating user applications that are dependant on specific version features (or mis-features)?
  • Where will extensions be installed?
  • Where will docs, demos, etc. be installed?

jmpb 2006-12-29: Thought it was worth mentioning: tclkits, starkits and starpacks ;). The OS need not come with Tcl. This is IMHO a valid answer to all of those questions (except maybe extensions, docs, demos, etc. - online or downloaded in a starkit).