Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Please use your CyberCNS Domain/Tenant name in the CyberCNS Agent download link mentioned in the script as shown below:

e.g. cybercnstenant value should be learn for CyberCNS Domain/tenant learn.

The script for CyberCNS V3:

View file
namelinux.sh

Note: The script for new infrastructure: ( this script has changed agent download URL which is suitable for new infrastructure)

Old The Script used for CyberCNS V2:

Code Block
#!/bin/bash


# checking wether the user is root or normal user
function check_root {
    if [[ "x$(id -u)" != 'x0' ]]; then
        echo 'Error: this script can only be executed by root'
        exit 1
    fi
}

# checking wether the agent already exists if not will install the agent
function install_lightweight {

   if [ -z "$cybercnscompanyid" ]
   then
         echo "\$cybercnscompanyid  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsclientid" ]
   then
         echo "\$cybercnsclientid  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsclientsecret" ]
   then
         echo "\$cybercnsclientsecret  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsdomain" ]
   then
         echo "\$cybercnsdomain  is NULL"
         exit 1
   fi

   pgrep cybercnsagentv2
   exitcode=$?
   if [ $exitcode -eq 0 ]; then
      echo "lightweight agent already running in the machine"
   else
      echo "Downloading http://<domain>.mycybercns.com/agents/ccnsagent/cybercnsagent_linux"
      exitcode=$(curl --write-out %{http_code} -L -g "http://<domain>.mycybercns.com/agents/ccnsagent/cybercnsagent_linux" -s -o cybercnsagent_linux)
      if [ $exitcode -ne 200 ]; then
              if [ "$exitcode" == "000" ]; then
                 exitcode=-1
              fi
              
              echo "Was not able to fetch the lightweight cybercnsagent agent for ubuntu"
              exit $exitcode
      fi
      chmod +x cybercnsagent_linux;
      sudo ./cybercnsagent_linux -c $cybercnscompanyid -a $cybercnsclientid  -s $cybercnsclientsecret -b $cybercnsdomain -i LightWeight
   fi
}


function install {
    check_root
    install_lightweight
}

install

...

Note: The script for new infrastructure: ( this script has changed agent download URL which is suitable for new infrastructure)

The Script used for CyberCNS V3:

View file
namelinux_probe.sh

Old The Script used for CyberCNS V2:

...