cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2447
Views
10
Helpful
7
Replies

Access Databases LMS 4.2 with jython script ( Integration with HP uCMDB )

MSCHURR_2
Level 1
Level 1

Questions / Integration Adapter Cisco Prime.

There is an integration adapter for HP uCMDB to get CI information from Cisco Works (Prime whatever ….).

We set up a user for CW according to “Open Database Schema Support in Cisco Prime LAN Management Solution 4.2” , page 1ff.

According to this document we created a user lmsdatafeed. If we run this integration from HP uCMDB / DDM we can connect to rmeng database using jmx to port 43455, but we have not sufficient privileges to get all the needed information.

We tried to connect with a user that has full rights (Admin User), but we cannot connect at all with this user.

We use Cisco Prime LMS 4.2 and we want to have our network devices as Configuration Items (CI's) in our HP uCMDB

Our question:

Would it be save to give more privileges to the user lmsdatafeed ?

And if yes: How can this be done ?

Is it possible to give an admin user the rights to connect by jmx/jdbc ?

Below I post the communication protocol of the adapter, connection is OK and the first select statement to, but them this user doesn't have enough privileges. The error messages are in german for some reason ... (means: "User has not sufficient privileges to selet from DM_Dev_State")

Any help is appreciated !

==== snip =====

execution jobId="DS_CiscoPrime_CiscoWorks NetDevices" destinationid="e6ac2661c751b23929fb1cf4f97a536f">

                <destination>

                               <destinationData name="id">e6ac2661c751b23929fb1cf4f97a536f</destinationData>

                               <destinationData name="ip_address">172.28.193.55</destinationData>

                               <destinationData name="db_port">43455</destinationData>

                </destination>

                <protocol name="sql" cm_credential_id="20_1_CMS">

                               <object id="8c1f2739bad14d0bd6242574005249dd" id_type="CmdbObjectID" isReference="false" is_anchor="false">

                                               <attribute name="protocol_username" type="String">lmsdatafeed</attribute>

                                               <attribute name="protocol_netaddress" type="String">DEFAULT</attribute>

                                               <attribute name="sqlprotocol_encryption_method" type="String">None</attribute>

                                               <attribute name="protocol_port" type="String">43455</attribute>

                                               <attribute name="sqlprotocol_dbsid" type="Unknown" />

                                               <attribute name="sqlprotocol_truststore" type="Unknown" />

                                               <attribute name="protocol_timeout" type="String">20000</attribute>

                                               <attribute name="user_label" type="String">CW RME</attribute>

                                               <attribute name="cm_credential_id" type="String">20_1_CMS</attribute>

                                               <attribute name="protocol_index" type="Integer">2</attribute>

                                               <attribute name="protocol_type" type="String">sqlprotocol</attribute>

                                               <attribute name="sqlprotocol_dbname" type="Unknown" />

                                               <attribute name="sqlprotocol_dbtype" type="String">Sybase</attribute>

                               </object>

                </protocol>

                <params>

                               <param param_name="ignoreNodesWithoutIP" param_value="true" />

                               <param param_name="allowDnsLookup" param_value="false" />

                               <param param_name="rmeDbName" param_value="rmengdb" />

                               <param param_name="queryChunkSize" param_value="250" />

                               <param param_name="JOB_ID" param_value="DS_CiscoPrime_CiscoWorks NetDevices" />

                </params>

                <CONNECT start="9:43:6" duration="766" CMD="client_connect" RESULT="success" type="sql" credentialsId="20_1_CMS">

                               <ClientProperties>

                                               <prop name="protocol_index" value="2" />

                                               <prop name="protocol_timeout" value="20" />

                                               <prop name="credentialsId" value="20_1_CMS" />

                                               <prop name="sqlprotocol_dbname" value="" />

                                               <prop name="sqlprotocol_dbsid" value="" />

                                               <prop name="cm_credential_id" value="20_1_CMS" />

                                               <prop name="sqlprotocol_dbtype" value="Sybase" />

                                               <prop name="protocol_type" value="sqlprotocol" />

                                               <prop name="preurl" value="jdbc:sybase:Tds:%%ipaddress%%:%%protocol_port%%/%%sqlprotocol_dbname%%?CHARSET=cp1252" />

                                               <prop name="driver" value="com.sybase.jdbc2.jdbc.SybDriver" />

                                               <prop name="protocol_netaddress" value="DEFAULT" />

                                               <prop name="protocol_port" value="43455" />

                                               <prop name="sqlprotocol_encryption_method" value="None" />

                                               <prop name="user_label" value="CW RME" />

                                               <prop name="protocol_username" value="lmsdatafeed" />

                                               <prop name="sqlprotocol_truststore" value="" />

                               </ClientProperties>

                </CONNECT>

                <log start="9:43:6" severity="debug">[CiscoWorks_NetDevices.py:DiscoveryMain] Connected to CiscoWorks LMS Resource Manager Essentials database at port &lt;43455&gt;...</log>

                <EXEC start="9:43:6" duration="16" CMD="SELECT db_name()" RESULT="success" />

                <EXEC start="9:43:6" duration="0" CMD="next" RESULT="true" />

                <EXEC start="9:43:6" duration="0" CMD="getStringByIndex:1" RESULT="rmengdb" />

                <EXEC start="9:43:6" duration="0" CMD="next" RESULT="false" />

                <EXEC start="9:43:6" duration="359" CMD="SELECT COUNT(1) FROM lmsdatagrp.NETWORK_DEVICES" RESULT="success" />

                <EXEC start="9:43:6" duration="0" CMD="next" RESULT="true" />

                <EXEC start="9:43:6" duration="0" CMD="getStringByIndex:1" RESULT="214" />

                <EXEC start="9:43:6" duration="0" CMD="next" RESULT="false" />

                <log start="9:43:6" severity="debug">[CiscoWorks logger] [CiscoWorks_NetDevices.py:getNetworkDevices] Got &lt;214&gt; Network Devices...</log>

                <log start="9:43:6" severity="debug">[CiscoWorks logger] [CiscoWorks_NetDevices.py:getNetworkDevices] Got &lt;1&gt; chunks...</log>

                <EXEC start="9:43:6" duration="16">

                               <CMD>[CDATA: SELECT TOP 250 START AT 1 netdevices.Device_Id, deviceState.NetworkElementID, netdevices.Device_Display_Name, netdevices.Host_Name, netdevices.Device_Category, netdevices.Device_Model, netdevices.Management_IPAddress, deviceState.Global_State FROM lmsdatagrp.NETWORK_DEVICES netdevices JOIN dba.DM_Dev_State deviceState ON netdevices.Device_Id=deviceState.DCR_ID]</CMD>

                               <RESULT IS_NULL="Y" />

                               <ERROR class="com.sybase.jdbc2.jdbc.SybSQLException">

                                               <message>[CDATA: SQL Anywhere-Fehler -121: Berechtigung verweigert: Sie haben nicht die Berechtigung, aus "DM_Dev_State" auszuwählen]</message>

                                               <stacktrace>

                                                               <frame class="com.sybase.jdbc2.tds.Tds" method="processEed" file="Tds.java" line="2884" />

                                                               <frame class="com.sybase.jdbc2.tds.Tds" method="nextResult" file="Tds.java" line="2206" />

                                                               <frame class="com.sybase.jdbc2.jdbc.ResultGetter" method="nextResult" file="ResultGetter.java" line="69" />

                                                               <frame class="com.sybase.jdbc2.jdbc.SybStatement" method="nextResult" file="SybStatement.java" line="220" />

                                                               <frame class="com.sybase.jdbc2.jdbc.SybStatement" method="nextResult" file="SybStatement.java" line="203" />

                                                               <frame class="com.sybase.jdbc2.jdbc.SybStatement" method="queryLoop" file="SybStatement.java" line="1596" />

                                                               <frame class="com.sybase.jdbc2.jdbc.SybStatement" method="executeQuery" file="SybStatement.java" line="1581" />

                                                               <frame class="com.sybase.jdbc2.jdbc.SybStatement" method="executeQuery" file="SybStatement.java" line="419" />

                                                               <frame class="com.hp.ucmdb.discovery.library.clients.agents.DatabaseAgent" method="getTable" file="DatabaseAgent.java" line="267" />

                                                               <frame class="com.hp.ucmdb.discovery.library.clients.query.SqlClient$3" method="executePrivate" file="SqlClient.java" line="246" />

                                                               <frame class="com.hp.ucmdb.discovery.library.clients.executors.Executor" method="execute" file="Executor.java" line="26" />

                                                               <frame class="com.hp.ucmdb.discovery.library.clients.BaseClient" method="exec" file="BaseClient.java" line="365" />

                                                               <frame class="com.hp.ucmdb.discovery.library.clients.query.SqlClient" method="getTable" file="SqlClient.java" line="258" />

                                                               <frame class="com.hp.ucmdb.discovery.library.clients.query.SqlClient" method="executeQuery" file="SqlClient.java" line="209" />

                                                               <frame class="com.hp.ucmdb.discovery.library.clients.query.SqlClient" method="executeQuery" file="SqlClient.java" line="195" />

                                                               <frame class="sun.reflect.NativeMethodAccessorImpl" method="invoke0" file="NativeMethodAccessorImpl.java" line="-2" />

                                                               <frame class="sun.reflect.NativeMethodAccessorImpl" method="invoke" file="NativeMethodAccessorImpl.java" line="57" />

                                                               <frame class="sun.reflect.DelegatingMethodAccessorImpl" method="invoke" file="DelegatingMethodAccessorImpl.java" line="43" />

                                                               <frame class="java.lang.reflect.Method" method="invoke" file="Method.java" line="601" />

                                                               <frame class="org.python.core.PyReflectedFunction" method="__call__" file="PyReflectedFunction.java" line="-1" />

                                                               <frame class="org.python.core.PyMethod" method="__call__" file="PyMethod.java" line="-1" />

                                                               <frame class="org.python.core.PyObject" method="__call__" file="PyObject.java" line="-1" />

                                                               <frame class="org.python.core.PyInstance" method="invoke" file="PyInstance.java" line="-1" />

                                                               <frame class="org.python.pycode._pyx33" method="doQuery$2" file="ciscoworks_utils" line="60" />

                                                               <frame class="org.python.pycode._pyx33" method="call_function" file="ciscoworks_utils" line="-1" />

                                                               <frame class="org.python.core.PyTableCode" method="call" file="PyTableCode.java" line="-1" />

                                                               <frame class="org.python.core.PyTableCode" method="call" file="PyTableCode.java" line="-1" />

                                                               <frame class="org.python.core.PyFunction" method="__call__" file="PyFunction.java" line="-1" />

                                                               <frame class="org.python.core.PyObject" method="invoke" file="PyObject.java" line="-1" />

                                                               <frame class="org.python.pycode._pyx42" method="getNetworkDevices$1" file="CiscoWorks_NetDevices" line="65" />

                                                               <frame class="org.python.pycode._pyx42" method="call_function" file="CiscoWorks_NetDevices" line="-1" />

                                                               <frame class="org.python.core.PyTableCode" method="call" file="PyTableCode.java" line="-1" />

                                                               <frame class="org.python.core.PyTableCode" method="call" file="PyTableCode.java" line="-1" />

                                                               <frame class="org.python.core.PyFunction" method="__call__" file="PyFunction.java" line="-1" />

                                                               <frame class="org.python.core.PyObject" method="__call__" file="PyObject.java" line="-1" />

                                                               <frame class="org.python.pycode._pyx42" method="DiscoveryMain$6" file="CiscoWorks_NetDevices" line="480" />

                                                               <frame class="org.python.pycode._pyx42" method="call_function" file="CiscoWorks_NetDevices" line="-1" />

                                                               <frame class="org.python.core.PyTableCode" method="call" file="PyTableCode.java" line="-1" />

                                                               <frame class="org.python.core.PyTableCode" method="call" file="PyTableCode.java" line="-1" />

                                                               <frame class="org.python.core.PyFunction" method="__call__" file="PyFunction.java" line="-1" />

                                                               <frame class="org.python.core.PyObject" method="invoke" file="PyObject.java" line="-1" />

                                                               <frame class="org.python.pycode._pyx47" method="f$0" file="&lt;string&gt;" line="2" />

                                                               <frame class="org.python.pycode._pyx47" method="call_function" file="&lt;string&gt;" line="-1" />

                                                               <frame class="org.python.core.PyTableCode" method="call" file="PyTableCode.java" line="-1" />

                                                               <frame class="org.python.core.PyCode" method="call" file="PyCode.java" line="-1" />

                                                               <frame class="org.python.core.Py" method="runCode" file="Py.java" line="-1" />

                                                               <frame class="org.python.core.Py" method="exec" file="Py.java" line="-1" />

                                                               <frame class="org.python.util.PythonInterpreter" method="exec" file="PythonInterpreter.java" line="-1" />

                                                               <frame class="com.hp.ucmdb.discovery.library.execution.impl.ExecutionEngineImpl" method="executeScript" file="ExecutionEngineImpl.java" line="214" />

                                                               <frame class="com.hp.ucmdb.discovery.library.execution.impl.ExecutionEngineImpl" method="executeScript" file="ExecutionEngineImpl.java" line="189" />

                                                               <frame class="com.hp.ucmdb.discovery.library.execution.impl.ExecutionEngineImpl" method="executeScript" file="ExecutionEngineImpl.java" line="185" />

                                                               <frame class="com.hp.ucmdb.discovery.library.execution.impl.ExecutionEngineImpl" method="execute" file="ExecutionEngineImpl.java" line="102" />

                                                               <frame class="com.hp.ucmdb.discovery.probe.services.dynamic.core.TablesProcessorUtil" method="processDestinationTables" file="TablesProcessorUtil.java" line="119" />

                                                               <frame class="com.hp.ucmdb.discovery.probe.services.dynamic.core.DynamicService" method="discover" file="DynamicService.java" line="71" />

                                                               <frame class="com.hp.ucmdb.discovery.probe.agents.probemgr.taskexecuter.JobExecuter" method="launchTask" file="JobExecuter.java" line="1238" />

                                                               <frame class="com.hp.ucmdb.discovery.probe.agents.probemgr.taskexecuter.JobExecuter$JobExecuterWorker" method="launch" file="JobExecuter.java" line="993" />

                                                               <frame class="com.hp.ucmdb.discovery.probe.agents.probemgr.taskexecuter.JobExecuter$JobExecuterWorker" method="executeTask" file="JobExecuter.java" line="930" />

                                                               <frame class="com.hp.ucmdb.discovery.probe.agents.probemgr.taskexecuter.JobExecuter$JobExecuterWorker" method="run" file="JobExecuter.java" line="836" />

                                               </stacktrace>

                               </ERROR>

                </EXEC>

                <log start="9:43:6" severity="error">Failed executing query: &lt;SELECT TOP 250 START AT 1 netdevices.Device_Id, deviceState.NetworkElementID, netdevices.Device_Display_Name, netdevices.Host_Name, netdevices.Device_Category, netdevices.Device_Model, netdevices.Management_IPAddress, deviceState.Global_State FROM lmsdatagrp.NETWORK_DEVICES netdevices JOIN dba.DM_Dev_State deviceState ON netdevices.Device_Id=deviceState.DCR_ID&gt; on &lt;172.28.193.55&gt; Exception: Traceback (most recent call last): File "ciscoworks_utils", line 60, in doQuery com.sybase.jdbc2.jdbc.SybSQLException: com.sybase.jdbc2.jdbc.SybSQLException: SQL Anywhere-Fehler -121: Berechtigung verweigert: Sie haben nicht die Berechtigung, aus "DM_Dev_State" auszuwählen</log>

                <log start="9:43:6" severity="warn">[CiscoWorks_NetDevices.py:getNetworkDevices] No Network Devices found in chunk &lt;0&gt;</log>

                <log start="9:43:6" severity="debug">Closing JDBC connections...</log>

                <DISCONNECT start="9:43:6" duration="0" CMD="client_disconnect" RESULT="" IS_NULL="Y" type="sql" credentialsId="20_1_CMS" />

                <results>

                               <results_for_add_or_update>

                                               <vector />

                               </results_for_add_or_update>

                               <results_for_delete>

                                               <vector />

                               </results_for_delete>

                </results>

</execution>

===== snip ======

1 Accepted Solution

Accepted Solutions

No, only cli on the server

You can set a password for each database, or one password for all using the \CSCOpx\bin\dbpasswd.pl

A random generated password is used during installation unless you provided one.

These users are either part of the installed databases or created during installation. Not sure.

I have never tried to alter these users since they are used by the LMS applications, nor to add new users to the database. 

.

Since these users are SA/DBA you should be able to do and break anything you like on the databases   :-)

Cheers,

Michel

View solution in original post

7 Replies 7

Michel Hegeraat
Level 7
Level 7

Reading a database can DOS your LMS, but no permanent damage done. 

This doc will tell you about the databases available

https://supportforums.cisco.com/docs/DOC-8796

You can set a password for each database, or one password for all using

\CSCOpx\bin\dbpasswd.pl

Each databse has it's own  SA  user

if ($dsn eq 'ani'   ){$uid = 'cwsiSA'     ; }

if ($dsn eq 'cmf'   ){$uid = 'cmfDBA'     ; }

if ($dsn eq 'rmeng' ){$uid = 'DBA'        ; }

if ($dsn eq 'dfmEpm'){$uid = 'itemEpmUser'; }

if ($dsn eq 'dfmInv'){$uid = 'itemInvUser'; }

if ($dsn eq 'dfmFh' ){$uid = 'itemFhUser' ; }

if ($dsn eq 'opsxml'){$uid = 'DBA'        ; }

if ($dsn eq 'upm'   ){$uid = 'dba'        ; }

This should allow you to get the data

Do keep in mind that all tables (except the views defined for lmsdatafeed) are subject to change.

Cheers,

Michel

Joe Clarke
Cisco Employee
Cisco Employee

You are trying to select data from a table for which you do not have access.  The DM_Dev_State table is not part of the exported lmsdatafeed views.  The only available views are listed at

http://www.cisco.com/en/US/docs/net_mgmt/ciscoworks_lan_management_solution/4.2/database_schema/dbviews_42.html .  There is no way to allocate more privileges to the lmsdatafeed user.

Thanks gents ! Should it be possible to run such a script with an admin user ?

No,

You will need to use the database DBA / SA   'System Administrator' login.

This is not related to a login in the LMS application

Cheers,

Michel

thanks a lot. Can I simply configure this user using the GUI  ? Or is this a special user that is created during installation ?

And how can I get information about this user ?

No, only cli on the server

You can set a password for each database, or one password for all using the \CSCOpx\bin\dbpasswd.pl

A random generated password is used during installation unless you provided one.

These users are either part of the installed databases or created during installation. Not sure.

I have never tried to alter these users since they are used by the LMS applications, nor to add new users to the database. 

.

Since these users are SA/DBA you should be able to do and break anything you like on the databases   :-)

Cheers,

Michel

Hi Michel,

using the internal DBA Users solved our problems. Thank you very much for your help