A working copy of NMIS that opExport can read and export the data from, and a running MySQL server.
To create a new mysql database you will need to run a command like this
mysqladmin create opexport -u root -p |
After creating a new database you will want to create a new user and grant them access to the new database:
mysql -u root -p mysql> CREATE USER 'opexport'@'localhost' IDENTIFIED BY '42opexport42'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL ON opexport.* to 'opexport'@'localhost'; Query OK, 0 rows affected (0.01 sec) |
untar the file into a location of your choice, the default location is /usr/local/omk
cd /usr/local tar xvf ~/opExport-x86_64-1.0.0.tar.gz cd omk cp ./install/opCommon.nmis ./conf/opCommon.nmis cp install/omkd.init.d /etc/init.d/omkd chkconfig --add omkd chown -R nmis:nmis /usr/local/omkd |
copy the schema files to the conf directory, this should ONLY be done on the MySQL server, not on the NMIS servers
cd /usr/local/omk cp ./install/schema_set.json ./conf/ cp ./install/export-* ./conf/ chown -R nmis:nmis /usr/local/omk |
'opexport' => { 'opexport_sql_db_host' => 'localhost', 'opexport_sql_db_port' => '3306', 'opexport_sql_db_name' => 'opexport', 'opexport_sql_db_user' => 'opexport', 'opexport_sql_db_password' => '42opexport42', } |
This will need to be done on all of the servers, e.g. the MySQL Database server as well as all the NMIS servers that will be exporting data
service omkd start |
http://your.server.names.or.ip:3000/opExport/?opexport_connection_key=key123 |
This will then load the opExport dashboard.
The server that holds the MySQL Database holds the master copy of the schema, in order for an NMIS server to export it's daemon requires a schema to be pushed to it. NOTE: in this case the schema referred to is in opExport, not MySQL. opExport will use it's schema to create the MySQL tables for you.
Each NMIS server that will export it's data must be able to access the MySQL server with a simple host name (no dots), so you may need to edit /etc/hosts and add entries to allow this.
Additionally, the MySQL server requires the same for all the NMIS servers that will push to it, so again you may need to add them to it's /etc/hosts file.
Next, check that the MySQL server has a schema configured. From the dashboard loaded previously:
Or you can go directly to:
http://your.MySQL.server.name.or.ip:3000/opExport/schemas?opexport_connection_key=key123 |
For each NMIS server you wish to have export you need to push the schema, in a web browser load the dashboard again:
http://your.MySQL.server.name.or.ip:3000/opExport/?opexport_connection_key=key123 |
From here you can push the schema to each of your NMIS servers (which are running opExport). To push the schema fill out the form and submit it:
You can now verify that each of the NMIS servers have the schema:
http://your.NMIS.server.name1.or.ip:3000/opExport/schemas?opexport_connection_key=key123 |
The daemon on the SQL server can be tested to ensure it can connect to the database.
http://your.MySQL.server.name.or.ip:3000/opExport/database_test_connect |
This should return a message that looks like this:
{ 'message' => 'count of information_schema.tables: $VAR1 = [ [ \'32\' ] ]; ', 'success' => 'true' } |
If it cannot connect you might see an error like this
'Connection to database not found, database handle is null Access denied for user \'opexport\'@\'localhost\' (using password: YES)' |
There are two ways to transfer, the MySQL server can "pull" the data, or the NMIS server can "push" the data. You can load the dashboard from before (http://your.MySQL.server.name.or.ip:3000/opExport/?opexport_connection_key=key123) to help you push/pull the data (the dashboard can also be loaded from the NMIS server)
Data to be pushed is available from these schemas:
diskIOTable
ciscoConfig
interface
interfaceStatus
nmisConfig
nodeStatus
services
storage
system
The drop-down on in the dashboard should allow you to choose which schema you would like to push/pull. If it is empty you the server does not have any schemas and requires them to be pushed to it from the opExport daemon on the MySQL server (see the installation instructions above for this).
To run push or pull commands on the server you can also issue them directly to the daemon.pl file ( be sure to change the MySQL_server_name and NMIS_server_name in the commands below):
cd /usr/local/omk/script; ./opmantek.pl get "/opExport/push/?data_source=schema&node_destination=MySQL_server_name&data_source_name=system?opexport_connection_key=key123" ./opmantek.pl get "/opExport/pull/?data_source=schema&node_source=NMIS_server_name&data_source_name=system?opexport_connection_key=key12" cd -; |
# On the MySQL Server: (so pulling, system data in this case) */5 * * * * wget http://localhost:3000/opExport/pull/?data_source=schema&node_source=NMIS_SERVER_NAME&data_source_name=system?opexport_connection_key=key12 |
NOTE: This is an example, you will want to think about which data you want and how often you want to update it. Several wget lines will likely be required.
It is also possible to run these commands in a script after NMIS has run a collect. To do this create a file called nmis_post_proc.pl in nmis8/conf, make it the package pp, and define a doPP function to run what you need
Activity can be monitored by viewing the logs, to work properly you will need a browser that supports websockets (Chrome, Firefox, or IE 10). This link can also be found by clicking the "Views" drop-down in the menu of the dashboard.x
http://your.MySQL.server.name.or.ip:3000/opExport/logs |
This page will stay connected to the server and receive info from the server as it happens
Logs are located in /usr/local/omk/log. opDaemon.log will show errors that have occured, opLog_plugin.log will show timing.