Share This:

When learning a new programming language, it is common that you will see a simple "Hello World" program written in that language.

 

So, I wrote a Hello World program in TPL.

Actually, I wrote 2 of them:  One discovery pattern, and one syncmapping extension.

 

In TPL, the way to print "Hello World" is to use a log statement.

TPL provides a log statement for each logging level:

        log.info

        log.debug

        log.warn

        log.error

        log.critical

 

Here is a sample Hello World discovery pattern below.

LEGEND:

The yellow italics represent identifiers.  An identifier is a made-up name.

host_node is the name of a variable which is created by the pattern.  It is set to the host node that triggered the pattern.

The trigger for the pattern is a Host.

When discovery scans a Host, the pattern is triggered.

The Hello World pattern does nothing at all except to write some messages to the logs.

The messages can be found in this log file:   /usr/tideway/log/tw_svc_eca_patterns.log

 

============================================================================

 

Here is a 2nd simple discovery pattern which is more useful:  it adds a new attribute called "source" to a Host. 

 

LEGEND:

The yellow italics are identifiers.

The red italics is also an identifier, but further, host_node is the name of a variable, and it points to the host node in Discovery.

The trigger for the pattern is a Host.

 

======================================================================================================

 

And, finally, here is the sample syncmappping Hello World program:

 

LEGEND:

The yellow italics are identifiers.

The red italics are also identifiers, but further, they are variables.

host is the host node from Discovery.

computersystem_ci points to the BMC_ComputerSystem CI in the CMDB.

syncmapping's do not have a trigger statement

 

 

All 3 TPL's are attached.