Purpose

Some customers NMIS/OMK environments are are comprised of many servers.  Leveraging the built in automation tools of NMIS and OMK modules will simplify and standardize the deployment.

Automation of application configuration will greatly improve the consistency and efficiency of the application deployment, saving time in deployment and then in troubleshooting later.

Domain Wide Standard NMIS/OMK Properties

Some NMIS/OMK configuration properties will be the same across servers in an administrative domain.  Some popular examples follow, but any setting that would be the same across all servers should be considered.

  • Authentication methods
  • Authentication server parameters
  • Domain name
  • Single sign on parameters
  • Email server parameters
  • Collection policy
  • Threshold policy
  • Syslog parameters
  • Node Models
  • Icons

Server Unique NMIS/OMK Properties

  • NMIS host name
  • NMIS server name
  • OMKD hostname
  • OMK module hostname

Standardization Script Example

This is an example script that will set some attributes statically and prompt the user for server unique attributes.  This script converts the nmis8/conf/Config.nmis and omk/conf/opCommon.nmis files into a perl hash.  Any attribute may be set in these configuration files with a script such as this.  This script should be run on each server from the nmis8/admin directory as it relies on NMIS perl libraries.  Notice the use of FindBin in order to find the NMIS libraries.

#!/usr/bin/perl
use FindBin;
use lib "$FindBin::Bin/../lib";
use strict;
use func;

### This section sets domain wide NMIS properties.

my $auth_ldap_context = 'ou=example,dc=example.example,dc=com';
my $auth_ldap_server = '10.10.10.10';
my $auth_lockout_after = '3';
my $auth_method_1 = 'ldap';
my $auth_method_2 = 'htpasswd';
my $auth_method_3 = '';

my $company_logo = '/nmis8/ourLogo.jpg';

### This section sets domain wide OMK properties

### opCharts secion (OMK)
my $opcharts_gui_node_search_mode = 'prefetch';
my $opcharts_gui_refresh_time = '30';
### opConfig section (OMK)
my $opconfig_default_period = '10d';
my $opconfigd_update_delay = '1200';
my $opconfigd_update_rate = '30';
### opEvents section (OMK) 
my $opevents_dns_cache = '4800';
my $opevents_dns_retry = '200';

### This section is interactive and will prompt the user for server unique properties.

print "\nThis script will provision the NMIS/OMK server with serveral attributes.\nStatic attributes will be found at the top of the script.\nPlease open this script with a text editor and review them for accuracy.\n\nThis script will prompt the user for attrbitues that are unique to each server.\n\nPress Enter to continue.\n\n";
<>;
print "\nEnter the NMIS nmis_host value: ";
my $nmis_host = <>;
chomp $nmis_host;
print "Enter the NMIS server_name value: ";
my $server_name = <>;
chomp $server_name;
print "Enter the opEvents opevents_hostname value: ";
my $opevents_hostname = <>;
chomp $opevents_hostname;

### This section reads the current configuration files and loads them into their 
### respective hash's.

my $nmisConf = readFiletoHash(file=>'/usr/local/nmis8/conf/Config.nmis');
my $omkConf = readFiletoHash(file=>'/usr/local/omk/conf/opCommon.nmis');

### This section rewrites the properties we have set.

### NMIS Configuration 
$nmisConf->{'authentication'}{'auth_ldap_context'} = $auth_ldap_context;
$nmisConf->{'authentication'}{'auth_ldap_server'} = $auth_ldap_server;
$nmisConf->{'authentication'}{'auth_lockout_after'} = $auth_lockout_after;
$nmisConf->{'authentication'}{'auth_method_1'} = $auth_method_1;
$nmisConf->{'authentication'}{'auth_method_2'} = $auth_method_2;
$nmisConf->{'authentication'}{'auth_method_3'} = $auth_method_3;
$nmisConf->{'files'}{'company_logo'} = $company_logo;
$nmisConf->{'globals'}{'global_collect_Description'} = $global_collect_Description;
$nmisConf->{'system'}{'nmis_host'} = $nmis_host;
$nmisConf->{'system'}{'server_name'} = $server_name;

### OMK Configuration
$omkConf->{'authentication'}{'auth_ldap_context'} = $auth_ldap_context;
$omkConf->{'authentication'}{'auth_ldap_server'} = $auth_ldap_server;
$omkConf->{'authentication'}{'auth_lockout_after'} = $auth_lockout_after;
$omkConf->{'authentication'}{'auth_method_1'} = $auth_method_1;
$omkConf->{'authentication'}{'auth_method_3'} = $auth_method_3;
$omkConf->{'opcharts'}{'opcharts_gui_node_search_mode'} = $opcharts_gui_node_search_mode;
$omkConf->{'opcharts'}{'opcharts_gui_refresh_time'} = $opcharts_gui_refresh_time;
$omkConf->{'opconfig'}{'opconfig_default_period'} = $opconfig_default_period;
$omkConf->{'opconfig'}{'opconfigd_update_delay'} = $opconfigd_update_delay;
$omkConf->{'opconfig'}{'opconfigd_update_rate'} = $opconfigd_update_rate;
$omkConf->{'opevents'}{'opevents_hostname'} = $opevents_hostname;
$omkConf->{'opevents'}{'opevents_dns_cache'} = $opevents_dns_cache;
$omkConf->{'opevents'}{'opevents_dns_retry'} = $opevents_dns_retry;
$omkConf->{'opevents'}{'opevents_import_node_interfaces'} = $opevents_import_node_interfaces;

### This section writes the new configuration files with the updated properties.

writeHashtoFile(file=>'/usr/local/nmis8/conf/Config.nmis', data=>$nmisConf);
writeHashtoFile(file=>'/usr/local/omk/conf/opCommon.nmis', data=>$omkConf);

### This section asks the user if now is a good time to restart the OMK services.

print "\nConfiguration update is complete!\n";
print "\nIn order for the new OMK attributes to take affect the associated\n";
print "Daemons should be restarted.  Wold you like to restart the deamons now?\n";
print "yes or no?: ";
my $choice = <>;
chomp $choice;
if ( $choice eq "yes" ) {
    system("service opeventsd restart");
    system("service opconfigd restart");
    system("service omkd restart");
}
else {
    print "\nThe following Daemons will need to be restarted before these changes will take affect.\n";
    print "\t- opeventsd\n\t- opconfigd\n\t- omkd\n";
}
print "\nThis action is complete.\n\n";
  • No labels