Billy Yuliadi

LogicMonitor Staff
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Billy Yuliadi

  • Rank
    Community Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. PropertySources are one of the recent additions to LogicModules, they were introduced in v.83 (https://www.logicmonitor.com/release-notes/v-83-scriptable-properties-dashboards-report-two-factor-authentication/). They are a very powerful feature and you can use them for many other purposes other than just showing a Cisco Serial Number which is a common use case for this feature. I am going to focus this post on using PropertySources to improve a Device Inventory Report. For example, you have hundreds or thousands of SNMP devices being monitored and you want to know if any of the devices are having an issue collecting data through SNMP. It is not a viable solution to go through the device one by one and check if LogicMonitor collects data from them. Fortunately, there is an easy way on how to get this information using Device Inventory Report and PropertySources. The idea is to create a property source that can add a host property to a device if SNMP is not working, then we can create a device inventory report to show this property. Here is a sample of PropertySource that go through all SNMP devices and adds a host property called auto.snmp.working=no if SNMP is not working on a device. // import the logicmonitor snmp helper class import com.santaba.agent.groovyapi.snmp.Snmp; // getthesnmp host from the device properties def host = hostProps.get('system.hostname'); // retrieve the value for the specified OID try { oid_value = Snmp.get(host, ".1.3.6.1.2.1.1.1.0"); println "snmp.working=yes" } catch (Exception ex) { println "snmp.working=no"; } return (0); Then we can easily create a Device Inventory Reports and add this specific host property. Here is how the report looks like Another use case would be to build a device inventory report that shows a piece of basic information, such as the number of CPU cores or system memory of a Windows server. Some information such as system.totalmemory is available by default, so we should be able to pull this information directly from the devices. To get a number of CPU cores on a Windows server, here is a sample property source that pulls that information. You can easily add other information such as total memory or even processor type and so on. // This script counts the total number of processor cores across all processors on a device import com.santaba.agent.groovyapi.win32.WMI; def hostname = hostProps.get("system.hostname"); try { def wmiResponse = WMI.queryAll(hostname, "select NUMBEROFCORES from Win32_Processor"); def totalcores = 0; wmiResponse.each { corecount -> totalcores += (corecount.get('NUMBEROFCORES')).toInteger(); } println "Windows_CPUcorecount=" + totalcores; } // Catch any exceptions that may have occurred catch (Exception e) { //print exception out and return non- zero println e; return 1; } //Exit by returning zero return 0; Here is a sample of Device Inventory report with the PropertySources added. This is just of one of the things that you can do using PropertySources. You can also use PropertySources as applies to field in Datasources or even Alert Rules.
  2. Singapore is an island nation located in Southeast Asia and also home of LogicMonitor Asia office. Singapore while it is relatively small in sizes and population, it is strategically located blooming South East Asian market. Singapore is well known as country with good infrastructure, modern government and multi cultural background. One good example of this is Singapore government have been publishing various information such as Economics, Society, Health, Environment and other data publicly through their own website (data.gov.sg). Example of published data include Singapore population, Birth Rate, GDP data, government expenditure, and even environmental related data. Some example of environmental related data that we can retrieved are Temperature, PSI Reading, and rainfall reading. Here is an example of PM2.5 data which is formatted in JSON. We can make a LogicMonitor datasource based on this which can monitor air quality in Singapore. These information can be retrieved using HTTP request and supplying API key as part of HTTP headers. The response data can be divided into two parts, the first part mainly listed down regions and second part of the response is the actual air quality data. We can use Groovy script for Active Discovery to parse each region and listed it as an individual instance in LogicMonitor. Here is the sample of Active Discovery script What this script will do is to send http request to api.data.gov.sg and look for region name in the response body and print region name to this format instance1_id##instance1_name. After all instances are defined we can use regular HTTP data collection method to properly collect relevant data and displayed them in LogicMonitor. Here is data collection part of this datasource This is how it looks like on LogicMonitor when data is being collected and from here we can easily create graphs which can be use to show history of Singapore air quality On top of PM2.5 reading, we can also create another datasource that show PSI reading and current temperatures. We can clone this datasource and make some modification to match with http output for PM2.5 and Temperature. The next logical step would be to create a dashboard that can show all these information at glance which would look great if we show it on large screen such as TV in the meeting room. This would be useful especially during hazy season where air quality can go up to dangerous level from time to time. Here is an example of how we display these information on large screen using dashboard We can also use the same datasource to create an alert when air quality drops to unhealthy range and then deliver to our HipChat room. This is just an example of how LogicMonitor can monitor more than just IT infrastructure. In our case this will help us decide where we should go for lunch and whether we should bring our N95 masks along.