12 hours ago, Dominique said:
"set the jdbc.port property on the device." working on this now... Should it be a custom property as the jdbc properties already define for the cluster:
mssql.mssqlserver.mssql_url jdbc:sqlserver://10.12.172.26:1438;integratedSecurity=true;applicationIntent=ReadOnly
mssql.sqlclent1.mssql_url jdbc:sqlserver://10.12.172.26:1440;integratedSecurity=true;applicationIntent=ReadOnly
mssql.sqlclent2.mssql_url jdbc:sqlserver://10.12.172.26:1436;integratedSecurity=true;applicationIntent=ReadOnly
mssql.sqlclent3.mssql_url jdbc:sqlserver://10.12.172.26:1442;integratedSecurity=true;applicationIntent=ReadOnly
mssql.sqlclent4.mssql_url jdbc:sqlserver://10.12.172.26:1445;integratedSecurity=true;applicationIntent=ReadOnly
mssql.sqlclent5.mssql_url jdbc:sqlserver://10.12.172.26:1447;integratedSecurity=true;applicationIntent=ReadOnly
mssql.sqlclent6.mssql_url jdbc:sqlserver://10.12.172.26:1449;integratedSecurity=true;applicationIntent=ReadOnly
mssql.sqlclentgp1.mssql_url jdbc:sqlserver://10.12.172.26:1450;integratedSecurity=true;applicationIntent=Readnl
Ah, you have multiple ports on the server, this is new. This will take a bit of modification to the discovery script so that it can discover all the certificates from each DB instance. You don't need to store each full URL as a property on the server. You only need to list the port numbers, because that's the only thing that is different.
I've updated your discovery script to this:
import com.santaba.agent.groovyapi.expect.Expect;
import com.santaba.agent.groovyapi.snmp.Snmp;
import com.santaba.agent.groovyapi.http.*;
import com.santaba.agent.groovyapi.jmx.*;
import org.xbill.DNS.*;
import groovy.sql.Sql // needed for SQL connection and query
import groovy.time.*
hostname = hostProps.get("system.hostname");
user = ''
pass = ''
portList = hostProps.get("jdbc.mssql.portlist").tokenize(", ")
portList.each{port ->
SQLUrl = "jdbc:sqlserver://" + hostname + ":" + port + ";databaseName=master;integratedSecurity=true" //
sql = Sql.newInstance(SQLUrl, user, pass, 'com.microsoft.sqlserver.jdbc.SQLServerDriver')
sql.eachRow( 'SELECT name, expiry_date from sys.certificates'){
certname = it.name.toString().replaceAll("#","")
println(port + "_" + certname + "##" + certname + " (" + port + ")######jdbc.mssql.port=" + port)
}
}
sql.close() // Close connection}
return 0;
And I updated your collection script to this:
import com.santaba.agent.groovyapi.expect.Expect;
import com.santaba.agent.groovyapi.snmp.Snmp;
import com.santaba.agent.groovyapi.http.*;
import com.santaba.agent.groovyapi.jmx.*;
import org.xbill.DNS.*;
import groovy.sql.Sql // needed for SQL connection and query
import groovy.time.*
hostname = hostProps.get("system.hostname");
user = ''
pass = ''
portList = hostProps.get("jdbc.mssql.portlist").tokenize(", ")
portList.each{port->
SQLUrl = "jdbc:sqlserver://" + hostname + ":" + port + ";databaseName=master;integratedSecurity=true" //
sql = Sql.newInstance(SQLUrl, user, pass, 'com.microsoft.sqlserver.jdbc.SQLServerDriver')
sql.eachRow( 'SELECT name, expiry_date from sys.certificates'){
certname = it.name.toString().replaceAll("#","")
daystoexpire = TimeCategory.minus(new Date(),Date.parse("yyy-MM-dd HH:mm:ss.S",it.expiry_date.toString()))
println(port + "_" + certname + ".daystoexpire: " + daystoexpire.getDays())
}
sql.close() // Close connection
}
return 0
Also, since the script won't work without the property jdbc.mssql.portlist, I've added that to the AppliesTo. I also set the instances to be automatically grouped by port number. This is all on _SSL_Certificates_All_Weenig in your portal.