Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
micheledenardi
Valued Contributor

Ping IPs from QlikSense Script

I've got an inline table with some IPs.

Load IP Inline [

IP

192.168.1.1

192.168.1.2

192.168.1.3];

Exist one way to ping these IPs (like using Windows CMD command) and get the IP result into QlikSense Table ?

Thanks

1 Solution

Accepted Solutions
Highlighted
micheledenardi
Valued Contributor

Re: Ping IPs from QlikSense Script

This is the founded solution:

ServerList:

Load * Inline [

IP, Descripion

192.168.1.1, Server1: 192.168.1.1

192.168.1.2, Server2: 192.168.1.2];

for n=0 to NoOfRows('ServerList')-1

let vIP=Peek('IP',$(n),'ServerList');

    let vDescription=Peek('Descripion',$(n),'ServerList');

  

    Execute c:\Windows\System32\cmd.exe /c ping $(vIP) > E:\Test\PingResults.txt;

    ping:

    LOAD

        "@1:n"

    FROM [lib://BaseFolder/Test\PingResults.txt]

    (fix, codepage is 28591, embedded labels, record is 1 lines)

        where match("@1:n",'Request timed out.');

    if NoOfRows('ping')>0 then

    call SendeMail('To@domain.com','From@domain.com','','','Server unreachable!','$(vDescription) is unreachable.','E:\Test\PingResults.txt','',unreachable.','E:\Test\PingResults.txt','','','','');

end if

  

    Drop table ping;

next

Drop table ServerList;

let vIP=null();

let vDescription=null();

View solution in original post

1 Reply
Highlighted
micheledenardi
Valued Contributor

Re: Ping IPs from QlikSense Script

This is the founded solution:

ServerList:

Load * Inline [

IP, Descripion

192.168.1.1, Server1: 192.168.1.1

192.168.1.2, Server2: 192.168.1.2];

for n=0 to NoOfRows('ServerList')-1

let vIP=Peek('IP',$(n),'ServerList');

    let vDescription=Peek('Descripion',$(n),'ServerList');

  

    Execute c:\Windows\System32\cmd.exe /c ping $(vIP) > E:\Test\PingResults.txt;

    ping:

    LOAD

        "@1:n"

    FROM [lib://BaseFolder/Test\PingResults.txt]

    (fix, codepage is 28591, embedded labels, record is 1 lines)

        where match("@1:n",'Request timed out.');

    if NoOfRows('ping')>0 then

    call SendeMail('To@domain.com','From@domain.com','','','Server unreachable!','$(vDescription) is unreachable.','E:\Test\PingResults.txt','',unreachable.','E:\Test\PingResults.txt','','','','');

end if

  

    Drop table ping;

next

Drop table ServerList;

let vIP=null();

let vDescription=null();

View solution in original post