Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

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

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II
Author

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();

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

1 Reply
micheledenardi
Specialist II
Specialist II
Author

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();

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.