发布新帖

Encontrar

问题
· 十一月 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
登录或注册以继续
文章
· 十一月 10, 2023 阅读大约需 2 分钟

Using NativeAPI Command Line Extension from Java

In my previous articles, I described my Command Line Extension to NativeAPI.
Of course, this is also available for any other NativeAPI package.
So I created this example as a demo for the actual Java Contest.
<--break->
The package contains also an IRIS server in Docker for the demo
It is evident that it also works with any remote IRIS server.
You just have to provide it with my NativeAPI CommandLine Extension.

I think this demo is easy to follow and shows the essential features.

  • First, you install the package and start the container
  • then you start the demo
    docker-compose exec iris java rcc
  • Next, you connect  to your IRIS server defaults refer to the ádde IRIS server in the container
    >>> serverIP [127.0.0.1]:
    >>> serverPORT [1972]:
    >>> namespace [USER]:
    >>> username [_SYSTEM]:
    >>> password [SYS]:
    Connected to Instance IRIS on Server 1C09927CAE60 
  • Now, you get into the demo menu
    Select Demo to exercise 
     0 = free ObjectScript
     1 = $ZV from Server
     2 = Actual Time in Server
     3 = TimeZone Offset of Server
     4 = Server ArchitectureVendorModel
     5 = List Global in ZWRITE style
     * = Terminate demo
    
    And this is the result when you run through all 5 examples
  • 1
     IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2023.2 (Build 227U) Mon Jul 31 2023 18:04:28 EDT 
    
    2
     2023-08-15 07:42:16 
    
    3
     0 
    
    4
     x86_64 * Intel * Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz 
    
    0 
    >>> Your ObjectScript [ quit "?"]: quit $ZTS
     66701,27813.678790226 
    
    0 
    >>> Your ObjectScript [ quit "?"]: quit 17/4
     4.250000000000000000 
    
    0 
    >>> Your ObjectScript [ quit "?"]: quit 17/0
     <DIVIDE> 18 x^%ZX 
    
    5 
    >>> Your Global [^dc.MultiD]:
     ^dc.MultiD = 5
     ^dc.MultiD(1) = $lb("Braam,Ted Q.",51353)
     ^dc.MultiD(1,"mJSON") = "{}"
     ^dc.MultiD(2) = $lb("Klingman,Uma C.",62459)
     ^dc.MultiD(2,2,"Multi","a") = 1
     ^dc.MultiD(2,2,"Multi","rob",1) = "rcc"
     ^dc.MultiD(2,2,"Multi","rob",2) = 2222
     ^dc.MultiD(2,"Multi","a") = 1
     ^dc.MultiD(2,"Multi","rob",1) = "rcc"
     ^dc.MultiD(2,"Multi","rob",2) = 2222
     ^dc.MultiD(2,"mJSON") = "{""A"":""ahahah"",""Rob"":""VIP"",""Rob2"":1111,""Rob3"":true}"
     ^dc.MultiD(3) = $lb("Goldman,Kenny H.",45831)
     ^dc.MultiD(3,"mJSON") = "{}"
     ^dc.MultiD(4) = $lb("","")
     ^dc.MultiD(4,"mJSON") = "{""rcc"":122}"
     ^dc.MultiD(5) = $lb("","")
     ^dc.MultiD(5,"mJSON") = "{}"
     **** done ****
    
    Select Demo to exercise
     0 = free ObjectScript
     1 = $ZV from Server
     2 = Actual Time in Server
     3 = TimeZone Offset of Server
     4 = Server Architecture*Vendor*Model
     5 = List Global in ZWRITE style
     * = Terminate demo
    * >>> exit [OK]: Thank you for trying the demo

Video

GitHub

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