查找

文章
· 十一月 16, 2023 阅读大约需 5 分钟

Accessing the IRIS Terminal: A Comprehensive Guide for Visual Studio Code Users

Introduction

Since InterSystems has recently announced the discontinuation of support for InterSystems Studio starting from version 2023.2 in favor of exclusive development of extensions for the Visual Studio Code (VSC) IDE, believing that the latter offers a superior experience compared to Studio, many of us developers have switched or are beginning to use VSC. Many may have wondered how to open the Terminal to perform operations, as VSC does not have an Output panel like Studio did, nor an integrated feature to open the IRIS terminal, except by downloading the plugins developed by InterSystems.

Summary

  • Introduction 
  • Solutions
    • For Users with at least IRIS 2020.1 or IRIS IRIS 2021.1.2  – Use Web Terminal
    • For Users with at least IRIS 2023.2 – Use WebSocket Terminal
    • For Users with Docker-based IRIS
    • For users with IRIS Versions Prior to 2023.2 working on their local machine
    • For Users Coding on IRIS based on a remote server using an SSH connection

Solutions

There are various ways to open the Terminal in VSC, depending on the specific configuration you are using, I've summarized here the best solutions for any situation:

For Users with at least IRIS 2020.1.1 or IRIS 2021.1.2 – Use Web Terminal

Users that have at least IRIS 2020.1.1 or IRIS 2021.1.2 and that are allowed to install external extensions (somebody may be not due to his company policy about third party applications), might find useful the Web Terminal extension for VSC. For who doesn’t know, the Web Terminal is a web-based terminal for InterSystems products built with ObjectScript (e.g., IRIS, Caché, Ensemble, HealthShare, TrakCare) that allows to use a more advanced version of the Terminal inside the browser (here the project page). This VSC extension enables to launch a web-based terminal directly from VSC, with a simple click.

In order to open the Web Terminal, click on: InterSystems Tools  > select a namespace > click on one of the following icons (, ) to open Web Terminal on VSC terminal panel or on browser (press Alt to change the default icon):

 

 

For Users with at least IRIS 2023.2 – Use WebSocket Terminal

Users with at least IRIS 2023.2 can take advantage of the new "WebSocket Terminal" feature included in the latest version of the VSC extensions and they don’t need for additional workarounds.

In order to open the WebSocket Terminal, click on: InterSystems Tools > select a namespace > click on the icon next to the Web Terminal one.

Edit: For further information, check the interesting article @Brett Saviano wrote about it!

How to run ObjectScript commands in the VS Code integrated terminal

For Users with Docker-based IRIS

Those working with IRIS environments within Docker and using VSC can start a terminal session directly within the Docker environment.  

Click on the Docker voice in the Status Bar, and then choose Open Terminal in Docker.

I would like to thank @Evgeny Shvarov for the picture and the explanation about this point.

 

For users with IRIS Versions Prior to 2023.2 working on their local machine

For users that work with a version of IRIS that runs on their local machine, it is possible to set up a dedicated IRIS terminal within VSC:

    1. Open the settings.json file. You can find it in several ways, for example by clicking on View > Command Palette > type: “settings” > Open User Settings (JSON)
    2. Add the following code under "terminal.integrated.profiles.windows":
"terminal.integrated.profiles.windows":{

    "IRIS Terminal": {
    
        "path": [
    
            "C:\\InterSystems\\IRISHealth\\bin\\irissession.exe"
        ],
    
        "args": ["IRISHEALTH"],
    
        "icon": "terminal-cmd"
    } 

}

Note: Insert the right path of your irissession.exe.

c. To open the Terminal from VSC navigate to: Terminal > New Terminal > Launch Profile… > IRIS Terminal.

d. An 'IRIS Terminal' voice should now be available in the Terminal menu:

 

For Users Coding on IRIS based on a remote server using an SSH connection 

For those who work on a version of IRIS based on a remote server (e.g., a company server) accessible via SSH connection (e.g., using PuTTY) it is possible to use the Remote - SSH VSC extension to connect VSC directly to the server. In order to do so:

    1. Install the Remote - SSH: Editing Configuration Files extension on VSC;
    2. Click on the “Remote Explorer icon  in the sidebar;
    3. Select “Open SSH Config File

  

and open the configuration file with the path: C:\Users\<username>\.ssh\config

    1. Insert the following code into the configuration file: 
Host my-putty-connection

    HostName < IP address or server name >

    User < username >

    IdentityFile < private key path on your local machine >

    Port < port > 

The IP Address and Port correspond to the Host Name and Port specified in PuTTY, the Username is the user credential used to access the remote server and the IdentityFile is the file path to your PuTTY private key.

Note:  The original format of the private key generated by PuTTY (.ppk) cannot be read by VSC. To establish a connection between VSC and the remote server via PuTTY, you must duplicate the original private key and convert the new version into the .pem format. In order to do the conversion:

  1. Launch PuTTYgen application
  2. Under File menu, click Load private key
  3. Select your private key in .ppk format, then choose Open
  4. Under the Conversions menu, click Export OpenSSH Key (force new file format).
  5. Set a new name with the .pem extension and click the Save button.
  6. Link the path of this new .pem file to the IdentifyFile parameter in VSC
    1. Save the file. After a few seconds the new connection should appear in the Remote Explorer panel;
    2. Click "Connect in New Window..." to open the SSH connection in a new VSC window:
  7.  Select the operating system of your remote machine (only at the first access)
  8. In the new window, navigate to: Terminal New Terminal (or use the shortcuts Ctrl + ò or Ctrl + Shift + ò).
  9. You're now connected to the remote machine and can use its IRIS Terminal within VSC.

Note: This operation only works if you have initiated your remote connection via PuTTY previously and does not function when PuTTY is closed or when you are not connected to the remote server. This operation does not launch PuTTY, it only allows VSC to connect to the tunnel established by PuTTY.

To initiate a PuTTY connection through VSC, you can utilize a batch file (on Windows). The provided connect_remote.bat file employs the Plink command, which is included with PuTTY, to start a session:

@echo off

set SESSION="<your saved session name>"

plink -load %SESSION%

To start the session, simply type .\connect_remote.bat in VSC terminal to open the remote connection and insert your credentials.

Note: This latter method provide you the access to a Terminal version that supports all VSC shortcuts! Welcome back Ctrl+V, goodbye Shift+Insert 🎉

10 Comments
讨论 (10)6
登录或注册以继续
问题
· 十一月 15, 2023

Testing MIB file with a Rest API

Hello,

In response to the infrastructure needs of our company's service, I've created a small API that sends SNMP queries to InterSystems to visualize relevant data for retrieval when the infrastructure implements monitoring.

However, I'm experiencing a timeout issue when attempting to collect information using an SNMP walk. Here is the code for my API's SNMP service:

import snmp from "net-snmp";

const options = {
    port: 161,
    retries: 4,
    timeout: 3000,
    transport: "udp4", // Uniquement udp4 et udp6 possible
    trapPort: 162
};

const oids = [ "1.3.6.1.4.1.16563.4.1.15.1.4" ];

export const testWalk = () => {
    const session = snmp.createSession("localhost", "public", options);

    console.log("Session created");

    session.walk(oids[0], null, (error, varbinds) => {
        if (error) {
            console.log("error: " + error);
        } else {
            for (let i = 0; i < varbinds.length; i++) {
                if (snmp.isVarbindError(varbinds[i])) {
                    console.log(snmp.varbindError(varbinds[i]));
                } else {
                    console.log(varbinds[i].oid + " = " + varbinds[i].value);
                }
            }
        }
        session.close()
    });
};

I do have the 'session created' console.log, so I am able to successfully create the SNMP session. However, I encounter this error: 'error: RequestTimedOutError: Request timed out.' The OID corresponds to retrieving irisProdStatus (Current status of all existing productions, of which I have around ten).

I have tried both udp4 and udp6 transport methods. For session creation, I've attempted using localhost as well as 127.0.0.1.

I have InterSystems running in a local Docker container (with the network configured to be on the same 'local network' as my API). Here is my docker-compose file so that you can verify that the correct ports are open :

version: '3.8'
services:
  iris:
    build:
      context: .
      dockerfile: Dockerfile
      target: final
    restart: always
    command: --check-caps false --ISCAgent false
    ports:
      - 161:161/udp
      - 162:162/udp
      - 705:705
      - 1972:1972
      - 52773:52773
      - 53773:53773
    volumes:
      - ./:/home/irisowner/dev
    network_mode: bridge

On the InterSystems portal, I have enabled the %Service_Monitor service and checked the 'Start SNMP agent at system startup' checkbox.

 

I noticed after some research that Net-SNMP on Linux does not enable TCP port 705 by default, hence this error:

I followed these points from the documentation:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

However, I still can't start the snmpd service in the Docker container.

 

Did I miss anything? Is the SNMP library I'm using functioning correctly?

Thanks in advance for your feedback!

 

Best regards,

Cyril

1 Comment
讨论 (1)1
登录或注册以继续
公告
· 十一月 15, 2023

Remarkable Milestones: 16K...18K...8M... on InterSystems Developer Community!

Hello, our dear Members of the Community!

We're so happy to share with you that our InterSystems Developer Community has reached yet other AWESOME milestones 🎉:

📝 18,000 published posts

👥 16,000 registered members

👁 8,000,000 views

It's a big shoutout to all our fantastic members, as well as our admins, content managers, and moderators. Together, we've hit 16K members, 18K posts, and a whopping 8M views! 🙌

In a bit more than a year we've grown by 5K members, posted 8K more posts and gathered 3M new views! Isn't this amazing?! 🤩

This achievement is all thanks to you, our awesome community! We want to express our heartfelt thanks to each one of you for being a part of our gang of like-minded folks. Whether you're asking questions, sparking conversations, sharing your knowledge, or giving us your thoughts, you're the heartbeat of this lively community. You make us better and more useful, and we're thrilled to have you on this journey with us. ❤️

Thanks again! And let's grow together!

9 Comments
讨论 (9)7
登录或注册以继续
问题
· 十一月 15, 2023

Issue with accesing Caché database tables with Azure Datafactory

Hello community members!

I am trying to connect to Caché database from Azure data factory using ODBC connection. The aim is to read data from Caché and write it in Azure blob storage using copy activity. The ODBC connection is successful and i can see the Caché  tables, but i'm facing an error while reading the table contents.

I'm getting the below error :

ERROR [HY000] [Cache ODBC][State : S1000][Native Code 400]
[SQLCODE: <-400>:<Es ist ein nicht behebbarer Fehler aufgetreten >]
[Cache Error: <<PROTECT>%0AmBk1^%sqlcq.SYA.cls691.1 ^SB700(""),/database/db4/syb/>]
[Location: <ServerLoop - Query Fetch>]
[%msg: <Unexpected error occurred:  <PROTECT>%0AmBk1^%sqlcq.SYA.cls691.1 ^SB700(""),/database/db4/syb/>]

Can anyone suggest what could be going wrong here and where to look for the issue?

Thanks.


.

5 Comments
讨论 (5)2
登录或注册以继续
文章
· 十一月 15, 2023 阅读大约需 2 分钟

Java Global Editor

This is the related article to the package in Java Contest. 

I decided to present a CRUD++ Global Editor based on IRIS Native API for Java.
++ because it’s a little bit more than just Create, Read, Update, Delete
Visualization of a global is always important to review results immediately.

  • For this purpose, I have extended the API with a Tree Viewer that mimics  ZWrite and allows also the examination of subtrees.
  • A $Query Style Navigator Forward and Reverse operating for easy finding the Global node of interest.
  • Finally, an option to ZKill to delete the content of a Global Node without deleting the subtree below was added.

This required a small helper class on the server side as an extension to the default API

My strategy was to have a rather modest interface usable from the command line
as on Docker console or terminal and keep it as simple as possible. 
Fancy graphic interfaces just distract from the essential content of the example.

If there is any default or a previous value is displayed at input prompt.

In Docker container, the editor is already ready for use.

  • docker-compose exec iris java gedi

 You first connect to server 

        Welcome to IRIS NativeAPI Global Editor

>>> serverIP [127.0.0.1]:
>>> serverPORT [1972]:
>>> namespace [USER]:
>>> username [_SYSTEM]:
>>> password [SYS]:

        Connected to Namespace USER on Server 127.0.0.1:1972

 

Then you loop in the editor menue

 0 = Select Global
 1 = Select Subscripts
 2 = Query Forward
 3 = Query Reverse
 4 = Show Global Tree
 5 = Update Global Value
 6 = Delete Global Value
 7 = Delete Global Tree
 * = Exit Demo

Select the Global and the Subscript you want to work on . 
Especially Global name and Node Subscripts are kept for simple navigation.

0 Selecting the Global clears all Subscripts 

It can be a fresh nonexistent Global too 

1 The subscript you select is kept until you step to menu 0.

2 Move to the Next node with data.

 

The actual Subscript is updated by the new node

Moving beyond the last node clears Subscripts

3 Move to the Previous Node with data.

moving Reverse from the top node shows the last node

4 The Global tree is shown with the actualSubscript on top

The starting node doesn't need data to be accepted

5 Update or set a value to the Node.

or Update

6 This acts like ZKILL removing data but keeping the subnodes.

7 This is the default KILL destroying data and subnodes.

 * Leaving the editor.

I hope you enjoy it and vote for my demo in the contest.

GitHub

Video

2 Comments
讨论 (2)1
登录或注册以继续