Nueva publicación

検索

Artículo
· 19 nov, 2023 Lectura de 1 min

NativeAPI for Java from WebTerminal

Based on the successful solution for my 2nd contribution to the Contest 
I used an adapted version for this package. And have some findings I'd like to share.

Multiple communication steps over CPIPE may take time.
You won't recognize it on a fast machine. But a slower box with
Windows + Docker Desktop + your browser (and more) is neither
"Speedy Gonzales" nor a "Road Runner". 🙂

First observation you launch your OS command and see NO result
On the console, you just sit there and expect a reply.
Establishing the Connection to IRIS is a typical case.
Jour redirected Output is just empty.  

This happens every now and then since between submission of
the user input, execution, and filling of the redirection file is a delay.
Reading of the output file immediately after command submission
doesn't make sense.

So I had to add a delay before checking the result.
As the delay was not sufficient in some cases also a RePaint was added,

I also observed a similar effect also with my command pipe.
To avoid missing content it sometimes required double submission.
I didn't find a real solution, just a workaround.
It mostly happened in my private box.
The OpenDempServer was always fast enough.

Suggestions on how to trace and solve this are welcome.

1 Comentario
Comentarios (1)1
Inicie sesión o regístrese para continuar
Artículo
· 16 nov, 2023 Lectura de 5 min

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 🎉

8 comentarios
Comentarios (8)5
Inicie sesión o regístrese para continuar
Pregunta
· 15 nov, 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 Comentario
Comentarios (1)1
Inicie sesión o regístrese para continuar
Anuncio
· 15 nov, 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 comentarios
Comentarios (9)7
Inicie sesión o regístrese para continuar
Pregunta
· 15 nov, 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 comentarios
Comentarios (5)2
Inicie sesión o regístrese para continuar