A command line utility nco_sql is provided to interact with the Netcool Omnibus database from the command line. This utility is also often used in shell scripts.
rapidnco is an (apache licensed) open source tool that mimics the functionality of nco_sql utility.
Features
- No external dependencies other than a valid JVM
- Nothing to compile, just unzip the files into a directory
- Parameters (user, password, server, port, delimiter, query etc.) can be given as command line paramters or in a config file)
- Implemented as a simple groovy script that can be modified/enhanced to your hearts content
- Supports all SQL statements (select, update, etc.)
Installation
- Download the utility and unzip the contents to a directory
- Copy jconn2.jar file into the same directory. You can find this file in your Netcool Omnibus installation
- In Unix, make rapidnco.sh executable.
- set JAVA_HOME environment variable or modify rapidnco.sh to provide full path to the java executable.
Package contents
| File | Description |
|---|---|
| rapidnco.sh | unix shell script to execute the tool |
| rapidnco.cmd | windows shell script to execute the tool |
| rapidnco.groovy | groovy script that parses the command line options and executes the SQL command |
| rapidnco.conf | configuration file to specify the command line parameters |
| groovy-1.7.1.jar | groovy library |
| commons-cli-1.2.jar | apache commons cli library to process command line parameters |
| jconn2.jar | (Not included) JDBC library to connect to Netcool Omnibus server |
| license | apache 2.0 license file |
Usage
rapidnco.sh -h show the command line options
usage: usage: 'rapidnco.sh -s 192.168.1.11 -P 4100 -u ncuser -p mypwd -q "select * from alerts.status"' -c,--config <config> alternative configuration file (default is rapidnco.conf) -d,--delimiter <delimiter> delimiter to print between fields in the query output -h,--help usage information -P,--port <port> Netcool Omnibus server port number -p,--password <password> password for the user -q,--query <query> SQL query to execute -s,--server <server> ip or name of the Netcool Host -u,--userid <user> user name to connect to Netcool server
Examples:
// all parameters except the query provided in the rapidnco.conf file
rapidnco.sh -q "select * from alerts.status where Severity=1"
// password is not in the config file, provided as a command line argument instead
rapidnco.sh -p mypwd -q "select * from alerts.status where Severity=1"
// provide delimiter (other parameters provided in the config file)
rapidnco.sh -d " | " -q "select * from alerts.status where Severity=1"
// update a field (other parameters provided in the config file)
rapidnco.sh -q "update alerts.status set Severity=5 where Identifier='Downlink6LinkMon4Link'"
Support
Hi Dinesh,
I think this is due to a line in conf file having no value. The script does not have sufficient error checks so if you have a line like password= it gives an error.
I've created an issue for this http://www.ifountain.org/jira/browse/SUP-42
Please comment on the issue and paste your conf file if you're seeing a different problem.
Hi,
D:\Dinesh\rapidnco_1.0_10030801\rapidnco>java -classpath ./groovy-1.7.1.jar;./jc
onn3.jar;./commons-cli-1.2.jar groovy.lang.GroovyShell ./rapidnco.groovy -c rapi
dnco.conf
Caught: java.lang.ArrayIndexOutOfBoundsException: 1
at rapidnco$_run_closure1.doCall(rapidnco.groovy:28)
at rapidnco.run(rapidnco.groovy:25)
I get the above error when executing that rapidnco.cmd file in windows. I gave the correct credentials but it throws this error. Any idea
Regards,
Dinesh