Nova postagem

查找

Artigo
· Mar. 4 6min de leitura

Surveillance d'InterSystems IRIS avec Prometheus et Grafana

La surveillance de votre déploiement IRIS est cruciale. Avec l'obsolescence de System Alert and Monitoring (SAM), une solution moderne et scalable est nécessaire pour obtenir des informations en temps réel, détecter précocement les problèmes et améliorer l'efficacité opérationnelle. Ce guide explique comment configurer Prometheus et Grafana dans Kubernetes pour surveiller efficacement InterSystems IRIS.

Ce guide suppose que vous avez déjà déployé un cluster IRIS en utilisant l'InterSystems Kubernetes Operator (IKO), qui simplifie le déploiement, l'intégration et la gestion.

 


Pourquoi utiliser Prometheus et Grafana ?

Prometheus et Grafana sont des outils largement adoptés pour la surveillance et la visualisation cloud-native. Voici pourquoi ils sont appropriés :

  • Scalabilité : Prometheus gère efficacement l'ingestion de grandes quantités de données.
  • Alerting : Alertes personnalisables via Prometheus Alertmanager.
  • Visualisation : Grafana offre des tableaux de bord riches et personnalisables pour les métriques Kubernetes.
  • Facilité d'intégration : Intégration fluide avec les workloads Kubernetes.

Prérequis

Avant de commencer, assurez-vous d'avoir les éléments suivants :

  • Une connaissance de base de Kubernetes et Linux.
  • kubectl et helm installés.
  • Une familiarité avec les concepts de Prometheus (consultez la documentation officielle pour plus d'informations).
  • Une instance IRIS déployée avec IKO, refer to another article here.  

Étape 1 : Activer les métriques dans InterSystems IRIS

IRIS expose ses métriques via /api/monitor/ au format Prometheus. Assurez-vous que ce point d'accès est activé :

  1. Ouvrez le Management Portal.
  2. Accédez à System Administration > Security > Applications > Web Applications.
  3. Vérifiez que /api/monitor/ est activé et accessible par Prometheus.
  4. Testez l'accessibilité en naviguant à l'URL suivante :
http://<IRIS_HOST>:<PORT>/api/monitor/metrics


Étape 2 : Déployer Prometheus avec Helm

Nous allons utiliser le chart kube-prometheus-stack, qui inclut Prometheus, Alertmanager et Grafana.

  1. Créez un fichier values.yaml avec la configuration suivante :
    prometheus:
      prometheusSpec:
        additionalScrapeConfigs:
          - job_name: 'intersystems_iris_metrics'
            metrics_path: '/api/monitor/metrics'
            static_configs:
              - targets:
                  - 'iris-app-compute-0.iris-svc.commerce.svc.cluster.local:80' # Replace with your IRIS service
    
          # To scrape custom metrics from the REST API created in IRIS
          - job_name: 'custom_iris_metrics'
            metrics_path: '/web/metrics'
            static_configs:
              - targets:
                  - 'commerce-app-webgateway-0.iris-svc.commerce.svc.cluster.local:80'
            basic_auth:
              username: '_SYSTEM'
              password: 'SYS'
    • Explanation:
      • iris-app-compute-0.iris-svc.commerce.svc.cluster.local:80: The format of the target should follow this convention: <pod-name>-iris-svc.<namespace>.svc.cluster.local:80. Replace <pod-name> with your IRIS pod, specify whether you want to scrape compute or data pods, and adjust the namespace as needed.
      • basic_auth** section**: If authentication is required to access the IRIS metrics endpoint, provide the necessary credentials.
  2. Ajoutez le repository Helm:
    helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
    helm repo update
     
  3. Installez Prometheus avec Helm:
    helm install monitoring prometheus-community/kube-prometheus-stack -n monitoring --create-namespace -f values.yaml
  4. Vérifiez le déploiement:
    kubectl get pods -n monitoring
     

Étape 3 : Ajouter des métriques personnalisées avec l'API REST

Créez une page CSP personnalisée pour servir vos propres métriques :

 
CustomMetrics.REST

Déployez cette API sous une nouvelle application web appelée metrics dans IRIS.


Étape 4 : Vérifier l'installation de Prometheus

  1. Ouvrez l'interface Prometheus:(http://<PROMETHEUS_HOST>:9090).
  2. Allez dans Status > Targets et confirmez que les métriques IRIS sont collectées.

 


Étape 5 : Accéder à Grafana

1. Récupérez les détails du service Grafana :

kubectl get svc -n monitoring
  1. Accédez à Grafana via port-forwarding:
    kubectl port-forward svc/monitoring-grafana -n monitoring 3000:80
    Ensuite, ouvrez http://localhost:3000

Étape 6 : Se connecter à Grafana

  • Nom d'utilisateur : admin
  • Mot de passe : prom-operator (ou le mot de passe défini lors de l'installation).

 


Étape 7 : Importer un tableau de bord personnalisé

J'ai créé un tableau de bord personnalisé spécialement adapté aux métriques d'InterSystems IRIS, que vous pouvez utiliser comme point de départ pour vos besoins de surveillance. Le fichier JSON de ce tableau de bord est hébergé sur GitHub pour un accès et une importation faciles: Download the Custom Dashboard JSON

Pour importer le tableau de bord:

  1. Allez dans Dashboards > Import dans Grafana.
  2. Collez l'URL du fichier JSON dans le champ Import via panel JSON ou téléchargez le fichier directement.
  3. Assignez le tableau de bord à un dossier et à la source de données Prometheus lorsque cela est demandé.

 

Une fois importé, vous pouvez modifier les panneaux pour inclure des métriques supplémentaires, personnaliser les visualisations ou affiner la mise en page pour de meilleures analyses de votre environnement IRIS.


Conclusion

En suivant ce guide, nous avons configuré Prometheus pour collecter les métriques d'InterSystems IRIS et les visualiser avec Grafana. De plus, vous pouvez explorer d'autres outils de surveillance comme Loki pour une gestion efficace des logs et configurer des alertes avec Alertmanager, PagerDuty ou Slack.

Si vous avez des questions ou des commentaires, n'hésitez pas à nous contacter !

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· Mar. 4

Message Count

Looking for a SQL query or any other method to find the Unique/distinct message counts for all productions or at least per production namespace within a given time frame. For e.g TimeCreated = January 2025 (Whole month)

I have used the following, but its not restricting the numbers based on the TimeCreated filter. Every time a new message is processed by system, its added to the total. I am running the query in today's date

Select Sum(MsgCount)

From

(Select DISTINCT TargetConfigName, count(DISTINCT SessionID) as MsgCount

FROM ENS.MessageHeader 

Where TimeCreated >='2025-01-01 00:00:00' and TimeCreated<='2025-01-31 23:59:59'

Group By TargetConfigName) as Table

12 Comments
Discussão (12)3
Entre ou crie uma conta para continuar
Artigo
· Mar. 4 4min de leitura

計算プロパティの使用方法2

これは InterSystems FAQ サイトの記事です。
 

計算プロパティを定義する際に利用可能なキーワードが複数あります。

詳細は、以下をご参照ください。

計算プロパティの定義

実際のこれらのキーワードの関連性は、少々複雑ですので具体的なコードを作成して動作を確認してみます。 

以下のようなクラス定義を作成します。(プロパティとインデックス定義のみ表示します)

完全なクラス定義は以下より、ダウンロードできます。

サンプルクラス定義

Class Sample.Person Extends %Persistent [ ClassType = persistent, ProcedureBlock ]

{

Property FirstName As %String;
Property LastName As %String;
Property DOB As %Date;
Property Age1 As %Integer [ Calculated, SqlComputed, Transient ];
Property Age2 As %Integer [ Calculated, Transient ];
Property Age3 As %Integer [ Calculated, SqlComputed ];
Property Age4 As %Integer [ Calculated ];
Property Age5 As %Integer [ SqlComputed, Transient ];
Property Age6 As %Integer [ Transient ];
Property Age7 As %Integer [ SqlComputed ];
Property Age8 As %Integer [ SqlComputed, SqlComputeOnChange = DOB ];
// インデックスは、Trancient = true の時には作れない
// Index IndexAge1 on Age1;
// Index IndexAge2 on Age2;
// Index IndexAge5 on Age5;
// Index IndexAge6 on Age6;
Index IndexAge3 On Age3;
// インデックスは、SqlComputed = false の時には作れない
// Index IndexAge4 On Age4;
Index IndexAge7 On Age7;
Index IndexAge8 On Age8;
}

計算プロパティとしてAge(年齢)というプロパティを作ります。

年齢は、今日の日付から誕生日(DOB)を引き算して経過日数を求め、閏年を考慮しつつ年の日数で割り算することで求められます。

以下にキーワードの組み合わせによる違いについて表にまとめています。

 

同じような年齢プロパティがこれらのキーワードの組み合わせに基づき、8個定義されています。

計算プロパティは、このキーワードの組み合わせによりインデックスを設定できる場合があります。

そして上のコードのコメントに書いてあるとおり Trancient = trueおよびSqlComputed = falseが設定されているとインデックスを作ることができません。 従ってこのサンプルでは、Age3, Age7, Age8のみがインデックス作成可能です。

またAge1とAge2はインデックスが作成できない点で共通で、違いはSqlComputedの指定だけですが、結果がどのように計算されるかについて大きな違いがあります。

それではその計算がどの様にどのタイミングで行われるかを示すサンプルコードを実行してみます。

上のコードに予め含めておいたクラスメソッドを実行することで動作を確かめてみます。

USER>do ##class(Sample.Person).CalculatedPropertyTest()

^Sample.PersonD=1
^Sample.PersonD(1)=$lb("","Kaoru","Shinuchi",60000,18,18)

^Sample.PersonI("IndexAge3",18,1)=""
^Sample.PersonI("IndexAge7",18,1)=""
^Sample.PersonI("IndexAge8",18,1)=""
ID Age1 Age3 Age5 Age7 Age8 DOB FirstName LastName

1 18 18 18 18 18 60000 Kaoru Shinuchi

1 Rows(s) Affected^Sample.PersonD=1
^Sample.PersonD(1)=$lb("","Kaoru","Shinuchi",50000,18,46)

^Sample.PersonI("IndexAge3",46,1)=""
^Sample.PersonI("IndexAge7",18,1)=""
^Sample.PersonI("IndexAge8",46,1)=""
ID Age1 Age3 Age5 Age7 Age8 DOB FirstName LastName

1 46 46 46 18 46 50000 Kaoru Shinuchi

1 Rows(s) Affected

Age1の場合、このキーワードの組み合わせでは、プロパティの計算タイプは常に計算になります。

そしてTrancientなのでデータの実体は持ちません

Age2の場合、プロパティの計算タイプは、計算されないになります。そしてTrancientなのでデータの実体は持ちません。

さらにsqlComputedがFalseなのでSQLのフィールドとしても認識されません。

(但し、このサンプルコードでは示していませんが、クラスインスタンスの計算プロパティとしてはデータ取得可能です。)

Age3の場合、プロパティの計算タイプは、常に計算になります。

データの実体は持たず、その計算結果に基づきインデックスを生成します。

そしてデータが更新された場合にもその更新内容に基づきインデックスも更新されます。

Age4, 6はAge2と同様です。

Age5は、Age1と同じです。 

Age7の場合、プロパティの計算タイプは、トリガーによって計算になります。

しかし、SqlComputeOnChangeが定義されていないので、DOBが変更されてもその変更が検知できずに初回に設定された値をずっと保持したままです。

Age8の場合、プロパティの計算タイプは、トリガーによって計算になります。

ここでは、SqlComputeOnChangeが定義されているので、DOBが変更されるとその変更に基づきAgeが再計算されます。

Discussão (0)1
Entre ou crie uma conta para continuar
InterSystems Oficial
· Mar. 3

InterSystems Language Server 2.7 的最新变化

首先,祝开发者社区的各位成员新年快乐! 我们希望今年为大家带来更多好东西,今天我想介绍 VS Code的最新版 Intersystems Language Server 扩展程序。 大多数 Language Server 改进都可以通过 ObjectScript 扩展 UI 体验到,因此您可能不知道 2024 年我们发布了 Intellisense 和鼠标悬停等方面的许多改进。 请快速浏览 Language Server 更新日志 看看您错过了什么。 最近发布的2.7.0 版本带来了对 Windows ARM 平台的支持,因此,如果您使用 Surface Pro 11 这类设备(我正在用这台设备愉快地写这篇帖子),那么您现在可以在您的设备上获得出色的 ObjectScript 开发体验。 赶快试用一下,并在下方评论区中分享您的使用心得。

Discussão (0)0
Entre ou crie uma conta para continuar
Pergunta
· Mar. 3

<class 'ImportError'>: Unable to import required dependencies: numpy: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy so

I have pandas installed inside my C:/InterSystems/IRISHealth/mgr/python

 

Set pandas=##class(%SYS.Python).Import("pandas")                        
SET pandas=##CLASS(%SYS.Python).Import("pandas")
^
<THROW> *%Exception.PythonException <THROW> 230 ^^0^SET pandas=##CLASS(%SYS.Python).Import("pandas") <class 'ImportError'>: Unable to import required dependencies:
   numpy: Error importing numpy: you should not try to import numpy from
                                                                                its source directory; please exit the numpy source tree, and relaunch
                                                                             your python interpreter from there. - Import

1 Comment
Discussão (1)1
Entre ou crie uma conta para continuar