{"_id":"perfsonar","_rev":"30-a9305464f56479ad2662d30d08343fb0","name":"perfsonar","time":{"modified":"2022-06-23T18:25:38.868Z","created":"2013-12-21T20:50:55.072Z","0.0.0":"2013-12-21T20:50:55.878Z","0.0.1":"2013-12-23T00:11:52.233Z","0.0.2":"2013-12-23T00:30:55.976Z","0.0.3":"2013-12-23T19:11:46.032Z","0.0.4":"2013-12-23T19:15:15.819Z","0.0.5":"2013-12-23T19:18:06.631Z","0.0.6":"2013-12-23T19:19:07.995Z","0.0.7":"2013-12-23T21:27:49.845Z","0.0.8":"2013-12-23T21:36:38.103Z","0.0.9":"2013-12-24T02:52:40.893Z","0.0.10":"2013-12-25T17:55:22.058Z","0.0.11":"2014-01-15T23:44:50.458Z","0.0.12":"2014-02-13T22:17:18.188Z","0.1.0":"2017-02-12T00:47:43.918Z"},"maintainers":[{"name":"soichih","email":"soichih@gmail.com"}],"dist-tags":{"latest":"0.1.0"},"description":"perfsonar client","readme":"# node-perfsonar\n\nnode-perfsonar is a simple perfsonar client.\n\n```\nnpm install perfsonar\n```\n\n## Lookup Service\n\nperfSONAR provides global lookup service, which is a database of all perfSONAR toolkit sites that are\nregistered to the global lookup service. \n\nTo query it, you first need to know the hostnames for those global lookup services\n\n### ls.global.gethosts()\n\nReturn list of all active global lookup service instances.\n\n```javascript\nls.global.gethosts((err, hosts)=>{\n    if(err) throw err;\n    console.dir(hosts);\n});\n```\n\n```javascript\n[ 'http://ps-west.es.net:8090/lookup/records',\n  'http://ps-east.es.net:8090/lookup/records',\n  'http://monipe-ls.rnp.br:8090/lookup/records',\n  'http://ps-sls.sanren.ac.za:8090/lookup/records',\n  'http://nsw-brwy-sls1.aarnet.net.au:8090/lookup/records/' ]\n```\n\nEach lookup service instances contains different sets of hosts, so you basically need to query them all..\n\n### ls.query\n\nQuery lookup service. \n\nTo query for toolkit hosts do something like .. \n\n```javascript\nls.query('http://ps-west.es.net:8090/lookup/records', {\n    type: \"host\"\n}, function(err, records) {\n    if(err) throw err;\n    console.dir(records);\n});\n```\n\n```javascript\n{ 'host-vm': [ '0' ],\n  'host-administrators': [ '' ],\n  expires: '2017-02-12T02:25:54.153Z',\n  'host-hardware-processorcore': [ '4' ],\n  'host-os-kernel': [ 'Linux 2.6.32-504.16.2.el6.web100.x86_64' ],\n  'host-os-name': [ 'CentOS' ],\n  type: [ 'host' ],\n  'host-hardware-processorspeed': [ '2599.800 MHz' ],\n  'host-os-version': [ '6.8 (Final)' ],\n  'host-net-interfaces': [ 'lookup/interface/2b6a8267-f0d2-424f-9c5b-b3fcb37f58a1' ],\n  'host-productname': [ 'RS161-E2/PA2' ],\n  'client-uuid': [ '1df374e0-6b3c-42e0-aca1-f77c747c8e5f' ],\n  'pshost-bundle': [ 'perfsonar-toolkit' ],\n  state: 'renewed',\n  'host-net-tcp-maxbuffer-recv': [ '67108864 bytes' ],\n  'host-net-tcp-autotunemaxbuffer-send': [ '33554432 bytes' ],\n  'pshost-toolkitversion': [ '3.5.1.7' ],\n  'host-manufacturer': [ 'ASUS' ],\n  'host-hardware-cpuid': [ 'Dual Core AMD Opteron(tm) Processor 285' ],\n  'host-hardware-processorcount': [ '2' ],\n  'pshost-bundle-version': [ '3.5.1.7' ],\n  'host-net-tcp-congestionalgorithm': [ 'htcp' ],\n  'host-name': [ '137.78.167.76', 'ps-171-230-node1.jpl.nasa.gov' ],\n  uri: 'lookup/host/b6ce7f69-3bc7-476d-8276-394f0f8ca9e6',\n  'host-net-tcp-autotunemaxbuffer-recv': [ '33554432 bytes' ],\n  'group-domains': [ 'jpl.nasa.gov', 'nasa.gov' ],\n  'host-hardware-memory': [ '3390 MB' ],\n  'host-net-tcp-maxbuffer-send': [ '67108864 bytes' ],\n  ttl: [] }\n\n```\n\n> For URL, use entries obtained from ls.global.gethosts\n\nhost records isn't enough to know what services this host is running.. For that you need to query services by matching host's client-uuid field to service record's\n\n```javascript\nls.query('http://ps-west.es.net:8090/lookup/records', {\n    type: \"service\",\n    \"client-uuid\": \"1df374e0-6b3c-42e0-aca1-f77c747c8e5f\",\n}, function(err, records) {\n    if(err) throw err;\n    records.forEach((record)=>{\n        console.log(record['service-name']);\n    });\n});\n```\n\n```javascript\n[ 'MP Measurement Point' ]\n[ 'OWAMP Server' ]\n[ 'Measurement Archive' ]\n[ 'Traceroute Responder' ]\n[ 'Ping Responder' ]\n[ 'BWCTL Measurement Point' ]\n[ 'BWCTL Server' ]\n```\n\n> You can use \"host-url\" to look for services, but keep it mind that host-url changes constantly even for the same host. Use client-uuid if you are going to cache it.\n\n\n## Measurment Archive Methods\n\n### ps.ma.endpoint\n\nperfsonar server publishes lists of endpoints that it monitors.\nIf you know the hostname of the perfsonar instance, you can pull list of all endpoints.\n\n```javascript\nvar ps = require('perfsonar');\n\nps.ma.endpoint({server: \"ps-development.bnl.gov\", debug: true}, function(err, endpoints) {\n    if(err) throw err;\n    console.log(JSON.stringify(endpoints, null, 2));\n});\n```\n\nExample output.\n\n```javascript\n{ iperf: [],\n  owamp:\n   [ { src: '192.12.15.26',\n       dst: '192.5.207.251',\n       count: 18000,\n       bucket_width: 0.001,\n       schedule: [Object] },\n     { src: '192.41.230.19',\n       dst: '192.5.207.251',\n       count: 18000,\n       bucket_width: 0.001,\n       schedule: [Object] },\n    ...\n     { src: '128.135.158.216',\n       dst: '192.5.207.251',\n       count: 18000,\n       bucket_width: 0.001,\n       schedule: [Object] } ],\n  pinger:\n   [ { src: '192.5.207.251',\n       dst: '134.158.20.192',\n       _datakeys: [Object],\n       count: 10,\n       packetSize: 1000,\n       ttl: 255,\n       transport: 'icmp',\n       packetInterval: 1 },\n     { src: '192.5.207.251',\n       dst: '193.62.56.9',\n       _datakeys: [Object],\n       count: 10,\n       packetSize: 1000,\n       ttl: 255,\n       transport: 'icmp',\n       packetInterval: 1 },\n    ...\n     { src: '192.5.207.251',\n       dst: '192.101.161.186',\n       _datakeys: [Object],\n       count: 10,\n       packetSize: 1000,\n       ttl: 255,\n       transport: 'icmp',\n       packetInterval: 1 } ] }\n```\n\nWhy is iperf list empty? Because atlas-owamp.bu.edu is a latency monitoring instance. If you try atlas-bwctl.bu.edu instead, you will see iperf (but not owamp / pinger)\n\n```javascript\n{ pinger: [],\n  owamp: [],\n  iperf:\n   [ { src: 'perfsonar2.pi.infn.it',\n       dst: 'atlas-npt2.bu.edu',\n       protocol: 'TCP',\n       duration: 30 },\n     { \n       src: 'perfsonar-1.t2.ucsd.edu',\n       dst: 'atlas-npt2.bu.edu',\n       protocol: 'TCP',\n       duration: 30 }\n    ...\n     { src: 'lhcmon.bnl.gov',\n       dst: 'atlas-npt2.bu.edu',\n       protocol: 'TCP',\n       duration: 30 } ] }\n```\n\n### ps.ma.owamp\n\nYou can pull all owamp test results collected within the last hour by...\n\n```javascript\nvar ps = require('perfsonar');\nps.ma.endpoint({host: \"perfsonar-2.t2.ucsd.edu\"}, function(err, endpoints) {\n    if(err) throw err;\n    ps.ma.owamp({\n        host: \"perfsonar-2.t2.ucsd.edu\", \n        endpoints: [endpoints.owamp[0]]//just pick one from the list\n    }, function(err, data) {\n        if(err) throw err;\n        console.dir(data[0].endpoint); \n        console.dir(data[0].data); \n    });\n});\n```\n\nSample output..\n\n```javascript\n{ endpoint:\n   { src: '132.239.252.68',\n     dst: '169.228.130.40',\n     count: 108000,\n     bucket_width: 0.0001,\n     schedule: [ [Object] ] },\n  data:\n   [ { start_time: 1387644690221,\n       end_time: 1387644751188,\n       min_ttl: 252,\n       max_ttl: 252,\n       min_delay: 0.000287533,\n       max_delay: 0.000332832,\n       max_error: 0.000217438,\n       duplicates: 0,\n       sent: 600,\n       loss: 0 },\n     { start_time: 1387644751189,\n       end_time: 1387644810176,\n       min_ttl: 252,\n       max_ttl: 252,\n       min_delay: 0.000295639,\n       max_delay: 0.000352859,\n       max_error: 0.000217438,\n       duplicates: 0,\n       sent: 600,\n       loss: 0 }\n   ] \n}\n```\n\nOr, you can specify which endpoints you want to pull test results for, by using endpoints returned from ps.endpoints().\n\n```javascript\nvar ps = require('perfsonar');\nps.endpoint({host: \"perfsonar-2.t2.ucsd.edu\"}, function(err, endpoints) {\n    if(err) throw err;\n    ps.ma.owamp({\n        host: \"perfsonar-2.t2.ucsd.edu\",\n        endpoints: [endpoints.owamp[0]] //just pick one randomly from iperf endpoints\n    }, function(err, results) {\n        if(err) throw err;\n        console.dir(results[0]); //again, display data for the first endpoint (although there should be only 1)\n    });\n});\n\n```\n\nCurrently, you can only specify 1 endpoint (I don't know how to query it on perfsonar/ma service. If you know how, please let me now!)\n\nSample output.\n\n```javascript\n{ endpoint:\n   { src: '132.239.252.68',\n     dst: '169.228.130.40',\n     count: 108000,\n     bucket_width: 0.0001,\n     schedule: [ [Object] ] },\n  data:\n   [ { start_time: 1387747211387,\n       end_time: 1387747270209,\n       min_ttl: 252,\n       max_ttl: 252,\n       min_delay: 0.000152111,\n       max_delay: 0.000980377,\n       max_error: 0.000177383,\n       duplicates: 0,\n       sent: 600,\n       loss: 0 },\n     { start_time: 1387747244111,\n       end_time: 1387747302265,\n       min_ttl: 252,\n       max_ttl: 252,\n       min_delay: 0.000152111,\n       max_delay: 0.00146103,\n       max_error: 0.000177383,\n       duplicates: 0,\n       sent: 600,\n       loss: 0 },\n...\n```\n\n### ps.ma.iperf\n\nSimilar to ps.owamp, you can query iperf (bandwidth) test results. You can also set endpoints option to specify endpoint that you \nare interested in (you can only specify 1 endpoint -- for now)\n\n```javascript\nvar ps = require('perfsonar');\nvar now = new Date().getTime();\nvar host = \"chic-pt1.es.net\";\nps.ma.endpoint({host: host}, function(err, endpoints) {\n    console.dir(endpoints);\n    if(err) throw err;\n    ps.ma.iperf({\n        host: host,\n        starttime: now - 3600*1000*24*90,\n        endpoints: [ endpoints.iperf[0] ]\n    }, function(err, data) {\n        if(err) throw err;\n        console.log(JSON.stringify(data, null, 2));\n    });\n});\n```\n\nSample output..\n\n```javascript\n[\n  {\n    \"endpoint\": {\n      \"src\": \"hcc-ps02.unl.edu\",\n      \"dst\": \"128.211.143.4\",\n      \"protocol\": \"TCP\",\n      \"duration\": 30\n    },\n    \"data\": [\n      {\n        \"time\": 1380742483152,\n        \"throughput\": 928939000\n      },\n      {\n        \"time\": 1380788934185,\n        \"throughput\": 928712000\n      },\n      {\n        \"time\": 1380850884317,\n        \"throughput\": 920837000\n      },\n      {\n        \"time\": 1380907907430,\n        \"throughput\": 927410000\n      },\n      {\n        \"time\": 1380932116340,\n        \"throughput\": 893389000\n      },\n      {\n        \"time\": 1380967851138,\n        \"throughput\": 928438000\n      },\n      {\n        \"time\": 1380987632403,\n        \"throughput\": 928993000\n      },\n      {\n        \"time\": 1381027201152,\n        \"throughput\": 928007000\n      },\n      {\n        \"time\": 1381043975321,\n        \"throughput\": 929642000\n      },\n      {\n        \"time\": 1381073308622,\n        \"throughput\": 925931000\n      },\n      {\n        \"time\": 1381104010343,\n        \"throughput\": 928380000\n      },\n...\n      {\n        \"time\": 1382270196285,\n        \"throughput\": 929267000\n      },\n      {\n        \"time\": 1382309807414,\n        \"throughput\": 914432000\n      },\n      {\n        \"time\": 1382329802398,\n        \"throughput\": 929891000\n      },\n      {\n        \"time\": 1382339372381,\n        \"throughput\": 324325000\n      }\n    ]\n  }\n]\n```\n\n### ps.ma.pinger\n\nQuerying pingER results gathered within the last hour.\n\nWarning: pingER query is slow! Due to some seriously convoluted interface design..\n\n```javascript\nvar ps = require('perfsonar');\nvar now = new Date().getTime();\nvar host = \"perfsonar01.cmsaf.mit.edu\";\nps.ma.endpoint({host: host}, function(err, endpoints) {\n    ps.ma.pinger({\n        host: host,\n        endpoints: [ endpoints.pinger[0], endpoints.pinger[1] ]\n    }, function(err, results) {\n        if(err) throw err;\n        results.forEach(function(result) {\n            console.dir(result);\n        });\n    });\n});\n```\n\nSample output\n\n```javascript\n{ src: '18.12.1.171',\n  dst: '131.225.206.112',\n  _datakeys: [ '33' ],\n  count: 10,\n  packetSize: 1000,\n  ttl: 255,\n  transport: 'icmp',\n  packetInterval: 1,\n  data: [] }\n{ src: '18.12.1.171',\n  dst: '193.109.172.188',\n  _datakeys: [ '32', '52' ],\n  count: 10,\n  packetSize: 1000,\n  ttl: 255,\n  transport: 'icmp',\n  packetInterval: 1,\n  data:\n   [ { minRtt: 122.811,\n       maxRtt: 135.218,\n       medianRtt: 128.5,\n       meanRtt: 129.019,\n       iqrIpd: 13,\n       maxIpd: 13,\n       meanIpd: 8.667,\n       time: 1387650363000 },\n     { minRtt: 122.782,\n       maxRtt: 135.235,\n       medianRtt: 135,\n       meanRtt: 132.724,\n       iqrIpd: 13,\n       maxIpd: 13,\n       meanIpd: 5.778,\n       time: 1387651563000 },\n     { minRtt: 122.827,\n       maxRtt: 135.238,\n       medianRtt: 135,\n       meanRtt: 129.915,\n       clp: 33.333,\n       maxIpd: 13,\n       meanIpd: 10.833,\n       time: 1387653963000 },\n     { minRtt: 122.869,\n       maxRtt: 135.228,\n       medianRtt: 122,\n       meanRtt: 128.179,\n       clp: 33.333,\n       iqrIpd: 13,\n       maxIpd: 13,\n       meanIpd: 8.667,\n       time: 1387655173000 },\n...\n     { minRtt: 122.802,\n       maxRtt: 135.185,\n       medianRtt: 122,\n       meanRtt: 124.116,\n       maxIpd: 13,\n       meanIpd: 1.444,\n       time: 1387656373000 } ] }\n```\n\nYou can specify endpoints that you are interested in.  Unlike owamp / iperf, though, you can specify more than 1 endpoints, \nbut you have to use endpoints returned from endpoints() which contains _datakeys parameter.\n\n```javascript\nvar ps = require('perfsonar');\nvar host = \"perfsonar01.cmsaf.mit.edu\";\nps.ma.endpoint({host: host}, function(err, endpoints) {\n    ps.ma.pinger({\n        host: host,\n        endpoints: [ endpoints.pinger[0], endpoints.pinger[1] ]\n    }, function(err, results) {\n        if(err) throw err;\n        results.forEach(function(result) {\n            console.dir(result);\n        });\n    });\n});\n\n```\n\n### ps.ma.traceroute\n\nQuerying traceroute results gathered within the last hour.\n\n```javascript\nvar ps = require('perfsonar');\nvar now = new Date().getTime();\nvar host = \"perfsonar-2.t2.ucsd.edu\";\nps.ma.endpoint({host: host}, function(err, endpoints) {\n    ps.ma.traceroute({host: host, endpoints: [ endpoints.traceroute[0]]}, function(err, results) {\n        console.log(JSON.stringify(results, undefined, 2));\n    });\n});\n```\n\nSample output. \n\n```javascript\n{ src: 'atlas-npt1.bu.edu',\n  dst: 'ccperfsonar2-lhcopn.in2p3.fr' }\n{\n  \"time\": 1387756831000,\n  \"unit\": \"ms\",\n  \"routes\": [\n    {\n      \"hop\": \"192.5.207.1\",\n      \"rtts\": [\n        0.301,\n        0.433,\n        0.59\n      ]\n    },\n    {\n      \"hop\": \"192.5.89.141\",\n      \"rtts\": [\n        0.478,\n        0.556,\n        0.613\n      ]\n    },\n    {\n      \"hop\": \"192.5.89.29\",\n      \"rtts\": [\n        9.901,\n        10.082,\n        10.125\n      ]\n    },\n    {\n      \"hop\": \"error:requestTimedOut\",\n      \"rtts\": [\n        0,\n        0,\n        0\n      ]\n    },\n    {\n      \"hop\": \"193.51.186.177\",\n      \"rtts\": [\n        119.436,\n        119.841,\n        119.807\n      ]\n    },\n    {\n      \"hop\": \"192.70.69.130\",\n      \"rtts\": [\n        107.796,\n        110.56,\n        110.389\n      ]\n    },\n    {\n      \"hop\": \"193.48.99.78\",\n      \"rtts\": [\n        107.14,\n        119.619,\n        119.501\n      ]\n    }\n  ]\n}\n\n```\n\nValues usually contains 3 values.. for each tests. You have to have 1 and only 1 endpoint specified (for now)\n","versions":{"0.1.0":{"name":"perfsonar","version":"0.1.0","description":"perfsonar client","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/soichih/node-perfsonar.git"},"keywords":["perfsonar"],"author":{"name":"Soichi Hayashi","email":"soichih@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/soichih/node-perfsonar/issues"},"homepage":"https://github.com/soichih/node-perfsonar","dependencies":{"async":"*","ejs":"*","html-parser":"*","merge":"*","node-expat":"*","request":"^2.79.0","xml-stream":"*","xml2js":"*"},"devDependencies":{"mocha":"^3.2.0"},"gitHead":"2d959a9ce2490c15615f6ab2d391cede3da60116","_id":"perfsonar@0.1.0","_shasum":"12a5b8836f9cddb9ddedc171300f935a30827809","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"soichih","email":"soichih@gmail.com"},"dist":{"shasum":"12a5b8836f9cddb9ddedc171300f935a30827809","tarball":"https://registry.npmjs.org/perfsonar/-/perfsonar-0.1.0.tgz","integrity":"sha512-BmEl7vDzdMb7hGlp5yMeeu/0/K1jwLlFrI5fu5JWSHRbV0ciYQu3hGm7GvY6QagdioBhsSNVVWtMMptZxXCjZg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDa+qYlOTb4/GLRn8D6KqRgW4qkmBX0GjvcVICVx6m1jAIhALSFZ4b9psK4owwPDADpualEaFeAoKVihGfG8BYvzCUw"}]},"maintainers":[{"name":"soichih","email":"soichih@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/perfsonar-0.1.0.tgz_1486860463156_0.5234826558735222"}}},"homepage":"https://github.com/soichih/node-perfsonar","keywords":["perfsonar"],"repository":{"type":"git","url":"git://github.com/soichih/node-perfsonar.git"},"author":{"name":"Soichi Hayashi","email":"soichih@gmail.com"},"bugs":{"url":"https://github.com/soichih/node-perfsonar/issues"},"license":"MIT","readmeFilename":"README.md"}