kubeshark / scripts

Example scripts that can be used in Kubeshark's scripting system

Home Page:https://kubeshark.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kubeshark's Public Scripts Repository

This repository contains scripts that can be used in Kubeshark's scripting system.

Kubeshark supports custom-logic scripts that use hooks and helpers to trigger actions, supported by the available integrations, and based on programmatic decisions and/or on a schedule.

Kubeshark scripting language is based on Javascript ES5.

The following script example calculates the number of packets and overall traffic processed per minute using an L4 network hook (onPacketCaptured), some helpers and a job.

var packetCount = 0;
var totalKB = 0;

function onPacketCaptured(info) {
  packetCount++;
  totalKB += info.length / 1000;
}

function logPacketCountTotalBytes() {
  console.log("Captured packet count per minute:", packetCount);
  packetCount = 0;
  console.log("Total KB captured per minute:", totalKB);
  totalKB = 0;
}

jobs.schedule("log-packet-count-total-bytes", "0 */1 * * * *", logPacketCountTotalBytes);

About

Example scripts that can be used in Kubeshark's scripting system

https://kubeshark.co


Languages

Language:JavaScript 84.5%Language:Shell 14.4%Language:Dockerfile 1.1%