AppD Archive

Install/Config of SQLMonitor Extension

CommunityUser
Splunk Employee
Splunk Employee

I am rather new to java and am struggling to get SQLMonitor to detect the class for the MSSQL driver I have colocated with the MachineAgent Jar.

This is the yml I have in the extension config for connection settings:

servers:
  - server: "devsql"
    driver: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    connectionString: "jdbc:sqlserver://devsql:1433/databaseName=ads;user=sa;password=***"

Below is the error message that I receive.  I am launching the machine agent with the -jar param, which it is my understanding indicates to java to look in the directory of the executing jar for other classes.

[Agent-Monitor-Scheduler-1] 16 Jan 2015 11:05:29,160  INFO PeriodicTaskRunner - Periodic Task - setup metric feed for [SQLMonitor Task]
[Agent-Monitor-Scheduler-1] 16 Jan 2015 11:05:43,747 ERROR SQLMonitor - Class not found:
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver

Any help is appreciated.

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

It seems that your driver class is not in the classpath when you're starting the machine agent. You can:

1. Add the driver class to some directory

2. Add that directory to the classpath in the java command that starts the machine agent by using the -cp <directory> switch, with <directory> being the location of your driver file.

That ought to allow the driver class to be found.

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

So I have tried the second recommended action, but am receiving the same result.  Below is the specific startup params and directory contents.  Sorry if there is something simple I am missing here, but I appreciate the help.

C:\AppDynamicsMachineAgent>java -Xmx32m -jar machineagent.jar -cp "C:\AppDynamicsMachineAgent"

My dir looks like this:

Directory of C:\AppDynamicsMachineAgent

1/15/2015  05:05 PM    <DIR>          .
1/15/2015  05:05 PM    <DIR>          ..
1/14/2015  03:43 PM    <DIR>          conf
1/15/2015  11:08 AM    <DIR>          controlchannel
1/14/2015  03:43 PM    <DIR>          lib
1/14/2015  03:43 PM    <DIR>          local-scripts
1/16/2015  11:05 AM    <DIR>          logs
1/14/2015  03:43 PM         2,492,806 machineagent.jar
1/14/2015  03:48 PM    <DIR>          monitors
1/14/2015  03:43 PM             6,720 readme.txt
1/14/2015  03:43 PM    <DIR>          scripts
2/09/2014  02:17 PM           563,935 sqljdbc.jar
2/09/2014  02:17 PM           585,020 sqljdbc4.jar
2/09/2014  02:17 PM           586,192 sqljdbc41.jar
1/15/2015  11:08 AM    <DIR>          tmp

0 Karma

Arun_Dasetty
Super Champion

Hi,

Can you try either of the following and that should work:

- Run as

cmd> C:\AppDynamicsMachineAgent>java -Xmx32m  -cp "C:\AppDynamicsMachineAgent\sqljdbc.jar"  -jar machineagent.jar

- Update and save monitor.xml after copying sqljdbc.jar under C:\AppDynamicsMachineAgent\monitors\SQLMonitor\ directory and restart machine agent without -cp arg itself

<classpath>SQLMonitor.jar;sqljdbc.jar;sqljdbc4.jar</classpath>

Regards,

Arun

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

I have good news and bad news.  (The addition of the classpath to the driver in the monitor.xml is what did the trick.)

Bad news, I have a new error; the good news, I have a new error that is occurring after my query runs.  So it looks like I am connecting to my MSSQL instance and running the query, but there is something that causes the following error. 

ERROR SQLMonitor - SQLException:
com.microsoft.sqlserver.jdbc.SQLServerException: The requested operation is not supported on forward only result sets.

I have attached the log to help troubleshooting.

Thanks again for everyone that is helping.

0 Karma

Arun_Dasetty
Super Champion

Hi,

We see similar error in another customer environment and the error is resolved trying with attached jar, Can you replace the attached jar in zip file attached at sqlmonitor folder under machine agent directory after stopping the machine agent process and see how how it after restart with the error.

related info http://stackoverflow.com/questions/7886462/how-to-get-row-count-using-resultset-in-java

http://stackoverflow.com/questions/10668102/is-there-any-method-to-know-how-many-rows-resultset-cont...

Regards,

Arun

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

I have installed this jar in the directory and restarted the agent.  It is currently running the queries against the backend, but does not appear to be reporting to the Controller.  I have attached the Agent log and the Config for the machineagent.

0 Karma

Arun_Dasetty
Super Champion

Hi ,

We see you have not provided value for xml element <node-name></node-name> in controller-info.xml , Are you trying to auto register agent to an existing appserver agent node in Controller ui, if not please provide node name and check how it goes.

If issue persists, please send the zipped version of <machineagent_dir>/monitors/sqlmonitor/ and <machineagent_dir>/logs folder to debug further, and also screenshot from controller UI depicting the issue, to debug further.

Regards.

Arun

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

I have put in the node-name just to see the results.  I have not seen any change in outcomes.  I have attached the requested files.

0 Karma

Arun_Dasetty
Super Champion

Hi ,

We see no errors in machine agent logs, actually logs are provided for very short time in proivded logging period

[Thread-1] 20 Jan 2015 09:58:11,281 INFO SystemAgent - Stopping Machine Agent....
[Agent-Monitor-Scheduler-1] 20 Jan 2015 09:58:21,937 INFO PeriodicTaskRunner - Periodic Task - setup metric feed for [SQLMonitor Task]

Can you please expand "Application Infrastructure performance" section and expand tiers and see if "'Custom metrics" section is displayed under them, if no such section displayed restart machine agent java process as follows and check in metric browser whether "custom metrics" section shows up under corresponding tier in section "Application Infrastructure performance" 

java -Xmx32m -Dappdynamics.agent.uniqueHostId=OTService1-vvdm_new1 -jar machineagent.jar

and make sure the app, tier and node details exists as per current config in controller-info.xml

Above changes should resolve the issue, Keep us posted how it goes.

As we see machine agent registered fine as per logs, expanding "Application Infrastructure performance" in metric browser (refer Custommetricnotlisted.jpg for screen referred) should show "custom metrics" section when tier expanded in UI:

[Agent-Scheduler-1] 20 Jan 2015 09:58:15,057 INFO RegistrationChannel - Auto agent registration attempted: Application Name [Development] Component Name [SQLDataCollector] Node Name [SQLProxy]
[Agent-Scheduler-1] 20 Jan 2015 09:58:15,057 INFO RegistrationChannel - Auto agent registration SUCCEEDED!
[Agent-Scheduler-1] 20 Jan 2015 09:58:15,057 INFO SystemAgent - Registered Machine Agent with machine ID [348]

Regards,

Arun

0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...