shinken-solutions/shinken

use nodeset to concat host

Opened this issue · 1 comments

Hi all,

I would like to incoporate the nodeset module python from clustershell provided by CEA HPC in shinken:
https://github.com/cea-hpc/clustershell

(cluster)-[root@admin ~]$ yum info clustershell
Loaded plugins: auto-update-debuginfo, etckeeper, fastestmirror, langpacks, versionlock
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * epel: mirror.in2p3.fr
 * epel-debuginfo: mirror.in2p3.fr
Installed Packages
Name        : clustershell
Arch        : noarch
Version     : 1.8.4
Release     : 1.el7
Size        : 324 k
Repo        : installed
From repo   : Local-EPEL-7
Summary     : Python framework for efficient cluster administration
URL         : http://cea-hpc.github.io/clustershell/
License     : LGPLv2+
Description : ClusterShell is a set of tools and a Python library to execute commands
            : on cluster nodes in parallel depending on selected engine and worker
            : mechanisms. Advanced node sets and node groups handling methods are provided
            : to ease and improve the daily administration of large compute clusters or
            : server farms. Command line utilities like clush, clubak and nodeset (or
            : cluset) allow traditional shell scripts to take benefit of the features
            : offered by the library.

This will allow us to translate something like that to:

define hostgroup {
  hostgroup_name  node
  members         node0,node1,node2,node3,node4,node5,node6,node7,node8,node9,node10
}

to something like that:

define hostgroup {
  hostgroup_name  node
  members         node[0-10]
}

Someone can help me :)

Hello, another way to accomplish what you want to do is to invert the declaration, if that makes sense.

You can specify the hostgroups a machine is member of in the host declaration itself. It's sometimes easier.

With an intermediate template it's even easier.

For instance:

define hostgroup {
  hostgroup_name  node
}

define host {
  name node
  hostghoups node
  register 0
}

define host {
  use node
  host_name node0
}

An expansion mechanism already exists for things like business rules, perhaps could it be adapted to implement such a behavior.

For the moment, we've got few time available, unfortunately, and the effort is given to the python3 port, so don't expect it to be available too soon.