You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This page summarising some techniques for automating admin, especially node management.

NMIS Cluster Node Admin

When using an opHA NMIS cluster most node admin is performed on the "Main Primary" server, more details about that @ opHA 3 Redundant Node Polling and Centralised Node Management

Get a list of nodes using node_admin.pl

To get a list of nodes is easy, just ask node admin to get you a list.

/usr/local/nmis9/admin/node_admin.pl act=list

You can filter this by a group node nodes by adding group=GROUPNAME

/usr/local/nmis9/admin/node_admin.pl act=list group=GROUPNAME

Using a script to active nodes for opConfig

The following BASH script will let activate opConfig for all nodes on the primary server, opHA will then synchronise this to all the pollers.

#!/usr/bin/env bash

if [ "$1" == "" ]
then
	echo This script will update the opConfig enabled property for all nodes.
	echo give me any argument to confirm you would like me to run.
	echo e.g. $0 runnow
	exit
fi

NODELIST=`/usr/local/nmis9/admin/node_admin.pl act=list`

for NODE in $NODELIST
do 
    /usr/local/nmis9/admin/node_admin.pl act=set node=$NODE entry.activated.opConfig=1
done

This script could be easily modified to work on some nodes, with a pattern match e.g. 

NODELIST=`/usr/local/nmis9/admin/node_admin.pl act=list | grep NODENAMEPATTERN`

Alternatively you could use the group option to limit the list e.g. 

NODELIST=`/usr/local/nmis9/admin/node_admin.pl act=list group=GROUPNAME`

To run the script, create a file with the contents, using your favourite editor, we used the filename enable-opconfig-all-nodes.sh, once created, update the permissions so it is executable, or just run by prefixing with bash.

sudo bash enable-opconfig-all-nodes.sh

opConfig Automation

The following handy BASH script will run an opConfig discovery, which includes OS Info and credential discovery.  It will run this for all the nodes and it will only run if the node is enabled in opConfig.

#!/usr/bin/env bash

if [ "$1" == "" ]
then
	echo This script will run opConfig discovery all nodes.
	echo give me any argument to confirm you would like me to run.
	echo e.g. $0 runnow
	exit
fi

NODELIST=`/usr/local/nmis9/admin/node_admin.pl act=list`

for NODE in $NODELIST
do 
	/usr/local/omk/bin/opconfig-cli.pl act=discover node=$NODE entry.activated.opConfig=1
done

As the example above you could use a filter on the NODELIST statement to filter the nodes.



  • No labels