Fixed annoying issues which caused data not to appear in Elastic
Intersystems-Monitoring is an add-on package that you can add to any existing solution based on InterSystems IRIS and HealthConnect. It installs a Monitoring Production which collects information from the relevant Ensemble namespaces and send status update to Logstash, so that you can monitor your InterSystems Productions from Kibana Discover
A couple of important remarks before we dive deeper:
The Elastic stack, is comprised of Elasticsearch, Kibana, Beats, and Logstash. You might know it as the ELK Stack. It allows you to take data from heterogeneous sources, in any format, then search, analyze, and visualize.
If you target an organization that already knows and loves Elastic stack, Intersystems-Monitoring is a great add-on for your InterSystems IRIS and HealthShare HealthConnect-based solutions. If you are looking for a powerful way to monitor heterogeneous applications, you might want to tale a look at Elastic stack too!
Itzos, a Dutch systems integrator, has been using Intersystems-Monitoring for years to allow them viewing the state and events of the many InterSystems IRIS and HealthConnect instances they run using Kibana Discover - and they love it. They felt that sharing this with the InterSystems Community was a great way to give back.
The following information is being transmitted to logstash:
The following information is being transmitted to logstash from each Ensemble namespace:
The InterSystems-Monitoring package provides a foundation production named IRISELK.FoundationProduction.
This contains:
The package has a post-install step that configures IRISELK.FoundationProduction to run and autostart in the designated Monitoring namespace
InterSystems-Monitoring can be installed from package intersystems-monitoring using InterSystems Package Manager (ZPM).
Before that, make sure that you have a new namespace where you run the Monitoring production, which we usually call “MONITORING”
You might use method PreInstall() in class IRISELK.Setup.installer which you can download here: installer.cls.
You need to compile it and then call PreInstall():
set sc = ##class(IRISELK.Setup.installer).PreInstall()
This will create the “MONITORING” namespace with seperate databases for Code and Data, so that a package mapping can be created for only the Code database to the %All namespace
Then, switch to the newly created namespace:
zn "MONITORING"
and install the Intersystems-Monitoring package:
ZPM "install intersystems-monitoring"
This will:
After the package has been installed, you can override the configuration by calling the SetConfig method on class IRISELK.BusinessOperation.Config with the path of your own config file:
do ##class(IRISELK.BusinessOperation.Config).SetConfig("your config json location")
Last step is to start the production and set it to Autostart:
do ##class(IRISELK.Setup.installer).AutoStartProduction()
Now, when you switch to the “MONITORING” namespace and view the Production, you’ll see a picture like this:
This is a sample configuration file for InterSystems-Monitoring
{
"stage": "dev|tst|acc|prd|other",
"description": "Description of the business purpose of the instance",
"customer": "Name of customer",
"logstash-url": "url of the logstash instance, e.g. https://mydomain.com/logstash",
"logstash-ssl-config": "Default",
"logstash-check-server-identity": false,
"logstash-proxy-address": "optional proxy address, e.g. http://my-proxy.com:8081"
}
Please note that the config.json is re-read each time before a transfer is made to Logstash.
The Business Operation includes the following context information and includes it as HTTP headers:
Header name | Value |
---|---|
server_name | ##class(%Library.Function).HostName(), converted to lowercase. On Kubernetes, remove the pod-prefix |
k8s_namespace | Kubernetes namespace - only when on Kubernetes |
instance_name | ##class(%SYS.System).GetInstanceName(), converted to lowercase. |
instance_product_type | “IRIS for Health” or “HealthConnect” or “IRIS” |
instance_otap | stage property from config.json, expected values: “dev”, “tst”, “acc”, “prd”, or “other” |
instance_description | description property from config.json, should describe the business purpose of the instance |
server_client_name | customer property from config.json, can be filled with the customer name |
In order for the data to be stored in Elasticsearch, it first needs to be filtered in Logstash. Logstash needs a pipeline to filter this data. An example for this pipeline is provided within this repository called “pipeline.conf”. The input
section of this file contains the configuration for the inbound traffic from the Intersystems-Monitoring production. See the comments in the example file for more details.
The filter
section of this file already contains the necessary filters for the data from the Intersystems-Monitoring production. If you wish to add a service to the production, you can use the existing filters as a guideline. You could add the following to the pipeline to add data from a new service:
# rename array for filtering purposes in Kibana
else if [] {
mutate {
rename => ["", "iris" ]
}
# split array into seperate messages
split {
field => "iris"
}
# add target index for Elasticsearch and remove orginal message field
mutate {
add_field => { "[@metadata][target_index]" => "iris_newdataname_%{[headers][instance_name]}_%{[headers][instance_otap]}_%{+YYYY.MM}" } # name of index needs to be in lowercase!
remove_field => [ "message" ]
}
}
The output
section of this file contains the configuration for the outbound traffic to Elasticsearch. See the comments in the example file for more details.
It is recommended that you include the setup of the IRISELK Monitoring production in your own installer, so that you it can be automatically deployed.
These are the steps needed to make that work:
Make sure that the Intersystems Package Manager (ZPM) is loaded. This is automatically the case for the Community Edition, but needs to be done as a separate step in your project if you run with a commercial license key
Install the intersystems-monitoring pqackage using ZPM
ZPM "install intersystems-monitoring"
Make sure that you have a json config file that is properly configured for your instance
Call the SetConfig method on class IRISELK.BusinessOperation.Config to set
do ##class(IRISELK.BusinessOperation.Config).SetConfig("your config json location")
There are no known issues at this point in time
Use or operation of this code is subject to acceptance of the license available in the code repository for this code.
Fixed annoying issues which caused data not to appear in Elastic
Improved output of PostInstall
Upgraded package version to 1.0.3
Moved compilation of Namespace to PostInstall
Initial Release