TORRUS_TTPROCLIST(8)

πŸ“¦
version 3.00 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– TORRUS_TTPROCLIST(8) πŸ’–

okay bestie, so this is ttproclist from the torrus manual, section 8 (that's the sysadmin-stuff section, iykyk). it's a lil command that takes a template, smooshes a list of nodes into it, and spits out a brand new file. let's get into it πŸ¦‹


✨ NAME ✨

ttproclist β€” process a template with a nodelist πŸ’…


🌸 SYNOPSIS 🌸

torrus ttproclist --tmpl=TFILE --out=OFILE --nodes=NFILE [options...]

πŸŽ€ DESCRIPTION πŸŽ€

so basically, this command takes a Template-Toolkit template and a list of nodes (usually SNMP devices, you know the vibe) as its input. the output file is what you get when the template gets substituted, according to whatever options you gave it. and listen β€” --tmpl, --out and --nodes are mandatory. no cap. you literally cannot skip them, bestie. 🫢

this utility is lowkey iconic because it can generate the discovery instructions XML out of a predefined template plus a dynamically generated list of devices. OR, alternatively, it can produce Torrus XML configuration for a given list of objects, etc. versatile queen πŸ‘‘

the following variables are predefined when the template is processed:

  • nodes

Hash array of nodes. Hash keys are the node names. Values are symbolic names. If symbolic names are not defined, values are the same as keys.

  • param

Hash array of command-line parameters given in --param option.

  • nodesfile, creator

Informative variables. They can be used to produce the creation note in the resulting files. nodesfile returns the file name of nodes, and creator returns a detailed information how the file was generated, with timestamp and command line options.


πŸ‘‘ OPTIONS πŸ‘‘

  • --tmpl=TFILE β€” the file name of the input template. relative names are looked in the current directory and in /etc/torrus/templates. the file name may also be an absolute path. ✨
  • --out=OFILE β€” output file name. if no absolute path is given, the file is written in the current directory. πŸŽ€
  • --nodes=NFILE β€” the name of the nodes list. nodes should be separated by space or tab character or newline. additional information, referred to as symbolic name, can be supplied after a colon, of the form NODENAME:SYMBOLICNAME. πŸ’…
  • --param=NAME:VALUE,NAME:VALUE... β€” list of optional parameters that may be used in the template. 🌈

πŸ”₯ EXAMPLES πŸ”₯

the following example generates devdiscover input file from a template. the template is as follows:

 <?xml version="1.0" encoding="UTF8"?>
 <snmp-discovery>
 >>> usual DDX parameters here, like SNMP community and data-dir
  <param name="snmp-community" value="private"/>
  <param...
 >>> This loop generates per-host entries
  [% FOREACH n = nodes.keys.sort %]
  <host>
    <param name="snmp-host" value="[% n %]"/>
    <param name="symbolic-name" value="[% nodes.$n %]"/>
    <param name="output-file" value="nodes/[% n %].xml"/>
  </host>
  [% END %]
 >>> Generate the bundle file, so that you need only one
 >>> entry in torrus-site-config.pl
  <param name="output-bundle" value="[% param.BUNDLE %].xml"/>
 </snmp-discovery>

the following command would generate MY.ddx from template file MY.ddtmpl as described above. the file MY.nodes is a list of SNMP devices, one per line. then devdiscover is launched with MY.ddx as input. note also the short form of the command line wrapper. πŸ¦‹

 torrus ttproclist --tmpl=MY.ddtmpl \
   --nodes=MY.nodes \
   --out=/usr/local/etc/torrus/discovery/MY.ddx \
   --param=BUNDLE:MYNODES

 torrus dd --in=MY.ddx --verbose

in addition, you may put some common parameters in Template BLOCK statement in a separate file, and INCLUDE it in your templates. see the Template-Toolkit documentation for more detail. πŸ“š


πŸ’€ NOTES πŸ’€

see more documentation at Torrus home page: http://torrus.org


🌈 SEE ALSO 🌈

Template-Toolkit documentation: http://template-toolkit.org/

torrus(8), torrus_devdiscover(8)


πŸ’œ AUTHOR πŸ’œ

Stanislav Sinyagin <ssinyagin@k-open.com>


and that's the whole page bestie, we ate and left no crumbs πŸ“ this was torrus 3.00, dated 2023-05-02, from the TORRUS_TTPROCLIST(8) page. go template something iconic πŸ’…βœ¨

πŸ“¦ where this page comes from