Recent Discussions
Datapoints configuration Discussion
Hello Team, I am trying to create a custom datasource to check the service status. It retrieves a list of services from the host properties(auto.service.names), connects to the host using SSH, checks the status of each service using the systemctl command, and outputs the results. Active Discovery Script: 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.*; // Get the service names from the host property def serviceNames = hostProps.get("auto.service.names") ?: "" def serviceArray = serviceNames.split(",").collect { it.trim() } // SSH details for connecting to the host host = hostProps.get("system.hostname") user = hostProps.get("ssh.user") pass = hostProps.get("ssh.pass") port = hostProps.get("ssh.port")?.toInteger() ?: 22 cert = hostProps.get("ssh.cert") ?: '~/.ssh/id_rsa' timeout = 15000 // Timeout in milliseconds // Initialize JSCH for SSH connection import com.jcraft.jsch.JSch def getServiceStatus(serviceName) { def command = "systemctl is-active ${serviceName}" return getCommandOutput(command).trim() } def getCommandOutput(String input_command) { def output = "" def session = null def channel = null try { def jsch = new JSch() if (user && !pass) { jsch.addIdentity(cert) } session = jsch.getSession(user, host, port) session.setConfig("StrictHostKeyChecking", "no") session.setTimeout(timeout) if (pass) { session.setPassword(pass) } session.connect() channel = session.openChannel("exec") channel.setCommand(input_command) def commandOutput = channel.getInputStream() channel.connect() output = commandOutput.text } finally { if (channel) { channel.disconnect() } if (session) { session.disconnect() } } return output } // Output each service with its status serviceArray.each { serviceName -> def status = getServiceStatus(serviceName) println "${serviceName}##${serviceName}##Status: ${status}" } return 0 Collection Script: Below, I am trying to use the ##WILDVALUE## from the active discovery script to collect the service status value. com.jcraft.jsch.JSch // Initialize JSCH for SSH connection // SSH details for connecting to the host host = hostProps.get("system.hostname") user = hostProps.get("ssh.user") pass = hostProps.get("ssh.pass") port = hostProps.get("ssh.port")?.toInteger() ?: 22 cert = hostProps.get("ssh.cert") ?: '~/.ssh/id_rsa' timeout = 15000 // Timeout in milliseconds // Function to retrieve the service status def getServiceStatus(serviceName) { def command = "systemctl is-active ${serviceName}" def result = getCommandOutput(command) return result?.trim() } // Function to execute command and retrieve output def getCommandOutput(String command) { def output = "" def session = null def channel = null def reader = null try { def jsch = new JSch() if (user && !pass) { jsch.addIdentity(cert) } session = jsch.getSession(user, host, port) session.setConfig("StrictHostKeyChecking", "no") session.setTimeout(timeout) if (pass) { session.setPassword(pass) } session.connect() channel = session.openChannel("exec") channel.setCommand(command) channel.setInputStream(null) channel.setErrStream(System.err) reader = new BufferedReader(new InputStreamReader(channel.getInputStream())) channel.connect() def line while ((line = reader.readLine()) != null) { output += line + "\n" } // Ensuring the channel finishes before disconnecting while (!channel.isClosed()) { Thread.sleep(100) } } catch (Exception e) { println "Error executing command: ${e.message}" } finally { reader?.close() channel?.disconnect() session?.disconnect() } return output } // Retrieve the current service name based on ##WILDVALUE## def serviceName = datasourceinstanceProps.values().collect { it.wildvalue }.find { it != null } if (serviceName) { def status = getServiceStatus(serviceName) def statusValue = (status == "active") ? 1 : 0 println "Service:${serviceName} Status:${statusValue}" return statusValue } else { println "Error: No service name found for ##WILDVALUE##." return null } I need help creating the datapoint to collect service status value. Thanks in advance. The error I am currently getting: param prefix is not invalid in format - (valid_prefixes=[datacollector.], method=namevalue, param=datacollector)Hshukla3 days agoNeophyte46Views3likes2CommentsSQL CERTIFICATE MONITORING
How to monitor SQL certificate using port 1433? Do anyone have any custom groovy script to monitor All certificate using any port or any specific port specifically port 1433. We are using the certificate on our SQL server for their encrypted communication & need to check al servers certificate expiration days. Any help would be appreciated.sachin-tanwar27 days agoNeophyte39Views0likes2CommentsProgrammatic Ping Alert
We currently lack the ability to white list domain names on our firewall, so I have to do everything via IP. Recently I’ve come across an issue where a company won’t give me their external IP’s because they can change, or so they say. For several weeks I’ve pinged the IP’s and it has always been 1 of 4 IPs. Has anyone created some kind of ping alert that does something like “ping easypost.com and api.easypost.com if the IP’s returned are not in 169.62.110.130-169.62.110.133, alert me” I’m not much of a programmer myself so I’d need something pretty “plug and play”. TIA!Solved109Views7likes4CommentsModules for Citrix Cloud/DaaS/VAD monitoring
Hi, here are some modules to monitor Citrix DaaS/VAD via the Citrix Monitor API. These might be helpful with mixture of DaaS and on-prem VAD environments as the same modules can be used for both. Setup details are in the module notes, see the CitrixDaaS_Token notes for the Citrix Cloud API setup. I have made the .xml export of each module available on Github, they can be downloaded from here: https://github.com/chrisred/logicmonitor-citrixdaas The modules are: CitrixDaaS_ApplicationUsage.xml CitrixDaaS_ConnectionFailures.xml CitrixDaaS_DeliveryGroups.xml CitrixDaaS_LogonPerformace.xml CitrixDaaS_Machines.xml CitrixDaaS_Token.xml I'll try to keep an eye on this post for any questions.chrisred2 months agoNeophyte554Views22likes10CommentsLinux services and autodiscovery
Hey guys, I just wanted to let you know that I took LogicMonitor's default datasource, "Linux_SSH_ServiceStatus", and added auto discovery to it. The only thing that is needed at the resource or group level is that the following three properties are set: ssh.user ssh.pass linux.ssh.services.regex ( default: "sshd\.service" ) I published the datasource under 93Y4PC (currently under security review as of this post) The discovery script gets the output of systemctl list-units --all --type=service --plain --state=loaded | egrep service Loop through each line of the output and see if it matches the regex from the property, "linux.ssh.services.regex" A person could even set the regex to be ".*" which would grab all of the services.. then turn around and create a filter to exclude certain things. For example if I wanted everything but services with the name ssh in them, I could create a filter that says ##WILDVALUE## not contain ssh.Keimond3 months agoNeophyte84Views2likes4CommentsAzure Backup Job DS Discovery
We have a problem with the Azure Backup Job DS only doing discovery once every 7 days. Im interested to know if anyone else has seen this ? So looks like discovery ran on the 02/09 today is the 05/09 so we are missing the past couple days of jobs :(SolvedBarb3 months agoAdvisor67Views0likes6Comments