ContributionsMost RecentMost LikesSolutionsRe: Monitoring Gateway SIP Trunk Status via SSH through Command line Did you change line #8 to ssh port 22? You should also be able to uncomment line #37, assuming all the expect lines are accurate and work. Re: Monitoring Gateway SIP Trunk Status via SSH through Command line Try this one for Active Discovery. My applies to is hasCategory("CiscoVoiceDialControl") It was created for telnet but you should be able to tweak it. It is multi instance. // Import the LogicMonitor expect helper class import com.santaba.agent.groovyapi.expect.Expect // Get the hostname and credentials from the device property table def hostname = hostProps.get("system.hostname") def userid = hostProps.get("ssh.user") def passwd = hostProps.get("ssh.pass") def port = 23 // Default Telnet port def timeout = 5000 // Timeout in milliseconds // Open a Telnet connection def telnet_connection = Expect.open(hostname, port, timeout) telnet_connection.expect("Username:") telnet_connection.send("${userid}\n") telnet_connection.expect("Password:") telnet_connection.send("${passwd}\n") telnet_connection.expect("#") // Disable pagination and set terminal width telnet_connection.send("terminal width 0\n") telnet_connection.expect("#") telnet_connection.send("terminal pager 0\n") telnet_connection.expect("#") // Send command to display the SIP UA register status telnet_connection.send("show sip-ua register status\n") telnet_connection.expect("#") // Collect the command output def config = telnet_connection.before() // Close the Telnet connection telnet_connection.send("exit\n") telnet_connection.expectClose() // Print the raw output for debugging //println config // Initialize a list to hold parsed entries def entries = [] // Use regex to match each line of data def matcher = config =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\w+)\s+(\w+)\s+(\S+)/ while (matcher.find()) { def line = matcher.group(1) def peer = matcher.group(2) def expires = matcher.group(3).toInteger() def reg = matcher.group(4) def survival = matcher.group(5) def p_associ_uri = matcher.group(6) // Map Reg field: 0 for "yes" and 1 for "no" def regStatus = (reg == "yes") ? 0 : 1 // Create an entry map with the mapped Reg value def entry = [ 'Line': line, 'Peer': peer, 'Expires': expires, 'Reg': regStatus, // Mapped value 'Survival': survival, 'P-Associ-URI': p_associ_uri ] // Add entry to entries list entries << entry } // Output the parsed entries for LogicMonitor to pick up as individual datapoints entries.each { entry -> // println "Line: ${entry['Line']}, Peer: ${entry['Peer']}, Expires: ${entry['Expires']}, Reg: ${entry['Reg']}, Survival: ${entry['Survival']}, P-Associ-URI: ${entry['P-Associ-URI']}" println "${entry.Line}##${entry.Line}" } // Return a success code return 0 Below is for data collection. // Import the LogicMonitor expect helper class import com.santaba.agent.groovyapi.expect.Expect // Get the hostname and credentials from the device property table def hostname = hostProps.get("system.hostname") def userid = hostProps.get("ssh.user") def passwd = hostProps.get("ssh.pass") def port = 23 // Default Telnet port def timeout = 5000 // Timeout in milliseconds // Open a Telnet connection def telnet_connection = Expect.open(hostname, port, timeout) telnet_connection.expect("Username:") telnet_connection.send("${userid}\n") telnet_connection.expect("Password:") telnet_connection.send("${passwd}\n") telnet_connection.expect("#") // Disable pagination and set terminal width telnet_connection.send("terminal width 0\n") telnet_connection.expect("#") telnet_connection.send("terminal pager 0\n") telnet_connection.expect("#") // Send command to display the SIP UA register status telnet_connection.send("show sip-ua register status\n") telnet_connection.expect("#") // Collect the command output def config = telnet_connection.before() // Close the Telnet connection telnet_connection.send("exit\n") telnet_connection.expectClose() // Print the raw output for debugging //println config // Initialize a list to hold parsed entries def entries = [] // Use regex to match each line of data def matcher = config =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\w+)\s+(\w+)\s+(\S+)/ while (matcher.find()) { def line = matcher.group(1) def peer = matcher.group(2) def expires = matcher.group(3).toInteger() def reg = matcher.group(4) def survival = matcher.group(5) def p_associ_uri = matcher.group(6) // Map Reg field: 0 for "yes" and 1 for "no" def regStatus = (reg == "yes") ? 0 : 1 // Create an entry map with the mapped Reg value def entry = [ 'Line': line, 'Peer': peer, 'Expires': expires, 'Reg': regStatus, // Mapped value 'Survival': survival, 'P-Associ-URI': p_associ_uri ] // Add entry to entries list entries << entry } // Output the parsed entries for LogicMonitor to pick up as individual datapoints entries.each { entry -> println "${entry.Line}.Reg:${entry.Reg}" } // Return a success code return 0 I have one datapoint named Status and it looks like this. Re: Reporting on Alerts and SDTs I put this in as a suggestion as well. Re: An Error Occurred Click to Rerender Yes, just happened to me in My Module Toolbox. I was attempting to upgrade several datasources at once. New Support Portal Suggestions New Support Portal Suggestions Can the default sort order display the most recent tickets at the top? I do not need to see my oldest tickets at the top. Can a few date columns be added? Date Opened, Date Updated, Date Resolved Then I want to be able to add them or hide them from my list view. Can the ticket comments, correspondence and history be included in the email notification I receive when an update to a ticket has been made? I think its important to be able to correspond to tickets via email. Can we have that back? For organizational tickets - I see a contact name field but in my portal they are all blank. Will those be populated? Re: Issues automating Least Privelege at scale It looks like they are changing positions on this requirement. Still probably a good thing to do but at least it's not going to be forced. Important Security Announcement | LogicMonitor - 15844 Re: Anyone else getting Spammed with emails this morning? I just attempted to create a ticket and subsequently somehow created 3. I guess I'll just wait until I get a response from one of them. Also, I had chat support before but now I do not see the live support chat button as mentioned in the blog post. Re: I need to alert for 20 consecutive failed logon attempts within a 30 minute time period Will the complex filter option within an event source let you script a number of occurrences value or is it still just for basic filtering? I don't have LM Logs but would like to be able to account for a a bunch of consecutive failed logons but ignore when it occasionally happens. Cant use PowerShell unfortunately. Re: Collector Name Property That was my other thought but when I was looking at the API docs I didn't see a way to update the collector description. Might of read through it too fast. Collector Name Property I need to set a property on my collectors that equals the name of the collector. Name meaning the name of the server. ##HOST## cannot be used during collector down events and all we have to work with is ##AGENT_DESCRIPTION## which can be set to anything. Does anyone have a script that will get the name of the collector and set the value as a custom collector property? I feel like a token for this should exist and I am pretty sure I put this in as a suggestion years ago.
GroupsInner Circle Welcome to the Customer Showcase, sponsored by “The Inner Circle “. Feel free to peruse this Customer Story Showcase to read more about what our customers are doing out in the world and how LogicMonitor is supporting their journeys.11 Posts
Inner Circle Welcome to the Customer Showcase, sponsored by “The Inner Circle “. Feel free to peruse this Customer Story Showcase to read more about what our customers are doing out in the world and how LogicMonitor is supporting their journeys.11 Posts
Top ContributionsNew Cisco Meraki Datasources DroppedNew Support Portal SuggestionsRe: How WMI, DCOM, RPC and UAC effect access to remote Window Systems for MonitoringRe: ESX Host Services?ESX Host Services?Common Config Sources vs Legacy LM Config SourcesRe: Config Backup ReportsLM Config SearchingVMWare Check Datastores for unusual files/file extensions.Re: Resource Explorer