ContributionsMost RecentMost LikesSolutionsRe: Use a Property Source to find dead devices Hi All One of the latest portal updates appears to have broken this propertysource. The fix is to change this line println "LMStatus=" +response_obj.data.items[0].hostStatus.value to println "LMStatus=" +response_obj.data.items[0].hostStatus; No errors are any real concerns with the break, but the device will not report as dead without this fix. Dynamically group Interface Instances by Description. WARNING-This method will deleted all existing instances along with all historical data to any devices currently being monitored. DO NOT modify the original SNMP64_if datasource. Instead clone the SNMP64_if datasource or download my copy from the LogicMonitor Exchange RX4ZAG. It's recommendedto run both the original SNMP64_if and modified SNMP64_if untilhistorical data has accumulated. I needed to dynamically group interface instances based off the description. In this case, the interface description held details regarding the interface by includingDIA, UPLS, or CID. It is possible to group instances with a RegEX using this method.However, this only supports instance Name or Value. It is not possible to group by the instance description. Then a thought accord to me The ##WILDVALUE## would remain the same, just the name and description would be switched. Instead of your instances named"GigabitEthernet2/1/4", they would be named"Level3 100M DIA-Pri | CID BBQG24909" and allow a Regular Expression todynamically group them using the RegEx "CID=".*CID.*" Everything else will work as before. I cloned and modifiedthe datasource SNMP64_ifand switched the SNMP OID (Name) with the Description OID (Description). You can download a copy of this datasource from the LogicMonitor Exchange using the Locator ID:RX4ZAG Then I was able to use a Regular Expression to dynamically group the instances. This will create three groups CID, DIA, and UPLS that will group interfaces that include that string in the interface Name (Description). Graphics Card Monitoring This datasource monitors higher end graphic cards via Perfmon counters available on GithubfromAlexey Kamenv This generates great graphs for a "Gaming Machine Dashboard" so you can visualize your complete hardware overkill LM Exchange:HMXG2X Re: Is anyone interested in a utility to remotely bulk set WMI permissions (non-admin) ? This will definitely come in handy, Thanks Mike! Using LogicMonitor's API through PHP This is a great site that has a pre-configured PHP environment for testing. https://www.tutorialspoint.com/execute_php_online.php A handy EPOC time converter https://www.epochconverter.com/ Example PHP API script that will create a SDT for device ID 92. <html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php $accessID = 'u6MyF2T3Q9csqufyG79Z'; $accessKEY = '******************************'; $resourcePath = "/sdt/sdts"; $url = "https://lmjeffwoeber.logicmonitor.com/santaba/rest$resourcePath"; $epoch = round(microtime(true) * 1000); $httpVerb = "POST"; $data = array("type" => "DeviceSDT", "sdtType" => 1, "startDateTime" => 1501794715, "endDateTime" => 1502488624000, "deviceDisplayName" => "CentOSTEMP", "deviceId" => 92); $data_string = json_encode($data, true); $requestVars = $httpVerb. $epoch. $data_string. $resourcePath; // Generate Signature $sig = base64_encode(hash_hmac('sha256', $requestVars, $accessKEY)); // Setup headers $auth = 'LMv1 '.$accessID. ':'.$sig. ':'.$epoch; $headers = array('Content-Type: application/json', 'Authorization: '.$auth); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); curl_close($ch); var_dump($result); ?> </body> </html> The return looks like: "endHour":0, "endMinute":0, "duration":25016447, "startDateTimeOnLocal":"1970-01-1803:09:54CST", "startDateTime":1501794715, "endDateTimeOnLocal":"2017-08-1116:57:04CDT", "endDateTime":1502488624000, "isEffective":true, "type":"DeviceSDT", "deviceId":92, "deviceDisplayName":"CentOSTEMP" } Extending SNMP with results from a Python Script I setup a Raspberry Pi with a Sense Hat so I can track the internal Temperature and Humidity of my living room in Logic Monitor. The data is accessable from running a python script on the Raspberry Pi itself, but I didn't want to install a collector on that device. The solution I decided on was using Extend Snmp. This guide can be used as a template for similar logicMonitor task. I used Steve Francis's"How to teach an old snmpd new tricks" Blog post as a guide. The first step was creating the python script. This script reads the humidity and temperature readings from the Sense Hat, rounds the results and prints the output to STDOUT. from sense_hat import SenseHat sense = SenseHat() sense.clear() hum = sense.get_humidity() hum = round(hum,1) hum= str(hum) print hum temp = sense.get_temperature() temp = ((temp/5)*9)+32 temp = round(temp,1) temp= str(temp) print temp Next I added a line to the to the /etc/snmp/snmpd.conf file to extend SNMP. It basically tells the SNMP daemon to run the python script and include the output in the SNMP extend OIDs. extend lm-temp /usr/bin/python2.7 /home/pi/scripts/weather/tempature.py After a restart of the SNMP Daemon, you can see the actual output by walking.1.3.6.1.4.1.8072.1.3.2 $ !snmpwalk 10.73.42.116 .1.3.6.1.4.1.8072.1.3.2 Walking OID .1.3.6.1.4.1.8072.1.3.2 from host=10.73.42.116, version=v2c, port=161, timeout=3 seconds: 1.0 => 1 2.1.2.7.108.109.45.116.101.109.112 => /usr/bin/python2.7 2.1.20.7.108.109.45.116.101.109.112 => 4 2.1.21.7.108.109.45.116.101.109.112 => 1 2.1.3.7.108.109.45.116.101.109.112 => /home/pi/scripts/weather/tempature.py 2.1.4.7.108.109.45.116.101.109.112 => 2.1.5.7.108.109.45.116.101.109.112 => 5 2.1.6.7.108.109.45.116.101.109.112 => 1 2.1.7.7.108.109.45.116.101.109.112 => 1 3.1.1.7.108.109.45.116.101.109.112 => 47.3 3.1.2.7.108.109.45.116.101.109.112 => 47.3 79.0 3.1.3.7.108.109.45.116.101.109.112 => 2 3.1.4.7.108.109.45.116.101.109.112 => 0 4.1.2.7.108.109.45.116.101.109.112.1 => 47.3 4.1.2.7.108.109.45.116.101.109.112.2 => 79.0 Those last two OIDs is the humidity and Temperature output from my python script. Putting everything together. The OID for the humidity and temperature reported by my Raspberry Pi are .1.3.6.1.4.1.8072.1.3.2.4.1.2.7.108.109.45.116.101.109.112.1 and.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.108.109.45.116.101.109.112.2 respectively and can be included into a SNMP datasource as shown below I did run into some trouble with the SNMPdaemon accessing the hardware. Daemons usually run under self-named unprivileged users and I had to add the snmp user to the groups input and gpio so the daemon had access to the hardware. This was easy enough with the command "sudo addgroup snmp gpio" and "sudo addgroup snmp input". Monitor weather with the WeatherUnderground.com API This datasource uses the Weather Underground API to monitor weather conditions for multiple locations. This will require a Free Weather Underground API key. This key should be added as a device propertiesweather.api.key The datasource exchange locator isKT6NLM I have an example setup to monitor Austin, TX, Jupiter, FL, and Santa Barbara, CA To get started, add a new device under Expert mode and in the “Link to a URL” box add in api.wunderground.com Once the URL has been added to LogicMonitor click on “Add Monitored Instance”. Add the weatherdeatails datasource and an instance of your choice. In my example I used TX/austin. You can add in other locations under the instances tab. For a better understanding on what the Instances Values should be, acomplete API URL for Santa Barbara is http://api.wunderground.com/api/Your_Key/conditions/q/ca/santa_barbara.json The data source is using an HTTP GET appended to the host URL GET /api/##weather.api.key##/conditions/q/##WILDVALUE##.json HTTP/1.1 Host:##HOSTNAME## The instance values is just the STATE/city part of the API URL. Service Checks: beyond basic authentication Sometimes we run acrossed Service Check websites that use a new fancy way of logging in making passing basic Username and Password impossible like this example for Zerto. The login screen is a embedded Java application making it impossible to send the credentials in html. Although it may not be possible to emulate logging in to these sites it is possible to add the authentication header information and verify the site is up and login is possible. Finding the authentication header information can be a bit tricky as their are an infinite number of ways a website can store this information, but its should be easy enough to spot them in the headers. To view the header information with Chrome Dev Tool login to your site. Then right click and inspect the page. Lets take a look at Revzilla.com, a typical online store,as an example. First login and view the headers. Note the "my-account" in the URL and the "my-account" in the headers. That is the page headers we are looking for in this and most websites. Copy the Cookie string in to your clipboard. I've also seen this under a specific "Login.jps" or in a Authorization header, but this example with the cookie header is the most common. From LogicMonitor, setup a Service Web Check normally adding the page /my-account in one of the steps. In this example /my-account will be the only step. Then add in the cookie header and paste the string value. For normal use HTTP Version 1.1 and Method GET should be sufficient. These sites normally return a status 200 (OK) even for a failed login, you can ensure the login works by finding a string that appears after a successful login. I'll use "Your Zilla Cash" for this example. You can now verify and test the step. You can test further, but changing the verify further by removing the cookie and ensuring the Service check will not login and fail. Re: Tracking DataSources changes with ConfigSource I used this trick today to monitor futurealert rule changes for a customer. Works great and they love it! Extreme Network Fan Status Simple datasource that monitors the FAN status of Extreme Network Switches. Will Alert Warning if !=1 GDZM7N
Top ContributionsLogicMonitor API and Alexa voice commands.Script Walkthrough - Automating Collector InstallsDynamically group Interface Instances by Description.Re: Is anyone interested in a utility to remotely bulk set WMI permissions (non-admin) ?Graphics Card MonitoringUsing LogicMonitor's API through PHPExtending SNMP with results from a Python ScriptMonitor weather with the WeatherUnderground.com APIService Checks: beyond basic authenticationExtreme Network Fan Status