<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Stats of Terminal Server Identity Agent in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Stats-of-Terminal-Server-Identity-Agent/m-p/51931#M3367</link>
    <description>&lt;P&gt;Simple script for monitoring stats by active sessions of Terminal Server Identity Agent:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
# Gaia 77.10

clear

echo Statistics for Terminal Server Identity Agent
echo
echo -------------------------------
pdp connections ts
echo -------------------------------

ts_list=( `pdp connections ts | grep -P "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"` )

for ts in "${ts_list[@]}"
do
   echo
   echo
   echo Stats for $ts
   echo -------------------------------

   active_session=`pdp monitor ip $ts | grep Client | awk '{ print $1 }' | wc -l`
   session_without_assigned_tcp_ports=`pdp monitor ip $ts | grep -B 3 "Tcp Ports: -" | grep @ | awk '{ print $1 }' | wc -l`
   session_without_assigned_udp_ports=`pdp monitor ip $ts | grep -B 3 "Udp Ports: -" | grep @ | awk '{ print $1 }' | wc -l`

   #echo $active_session
   echo Active Session: $active_session
   echo Sessions without assigned Tcp Ports: $session_without_assigned_tcp_ports
   echo Sessions without assigned Udp Ports: $session_without_assigned_udp_ports
done

echo -------------------------------&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and simple script for send stats to predefined syslog server:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
# Gaia 77.10

state=`cphaprob stat | grep local.*Active`

if [ "$state" ]; then

        ts_list=( `pdp connections ts | grep -P "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"` )

        for ts in "${ts_list[@]}"
        do
           active_session=`pdp monitor ip $ts | grep Client | awk '{ print $1 }' | wc -l`
           session_without_assigned_tcp_ports=`pdp monitor ip $ts | grep -B 3 "Tcp Ports: -" | grep @ | awk '{ print $1 }' | wc -l`
           session_without_assigned_udp_ports=`pdp monitor ip $ts | grep -B 3 "Udp Ports: -" | grep @ | awk '{ print $1 }' | wc -l`
           echo "TSIA stats for $ts: ts=$ts active_session=$active_session session_without_assigned_tcp_ports=$session_without_assigned_tcp_ports session_without_assigned_udp_ports=$session_without_assigned_udp_ports" 2&amp;gt;&amp;amp;1 | logger -t CheckPoint -p local3.warning &amp;amp;
        done
fi&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 26 Apr 2019 06:47:40 GMT</pubDate>
    <dc:creator>MK9</dc:creator>
    <dc:date>2019-04-26T06:47:40Z</dc:date>
    <item>
      <title>Stats of Terminal Server Identity Agent</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Stats-of-Terminal-Server-Identity-Agent/m-p/51931#M3367</link>
      <description>&lt;P&gt;Simple script for monitoring stats by active sessions of Terminal Server Identity Agent:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
# Gaia 77.10

clear

echo Statistics for Terminal Server Identity Agent
echo
echo -------------------------------
pdp connections ts
echo -------------------------------

ts_list=( `pdp connections ts | grep -P "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"` )

for ts in "${ts_list[@]}"
do
   echo
   echo
   echo Stats for $ts
   echo -------------------------------

   active_session=`pdp monitor ip $ts | grep Client | awk '{ print $1 }' | wc -l`
   session_without_assigned_tcp_ports=`pdp monitor ip $ts | grep -B 3 "Tcp Ports: -" | grep @ | awk '{ print $1 }' | wc -l`
   session_without_assigned_udp_ports=`pdp monitor ip $ts | grep -B 3 "Udp Ports: -" | grep @ | awk '{ print $1 }' | wc -l`

   #echo $active_session
   echo Active Session: $active_session
   echo Sessions without assigned Tcp Ports: $session_without_assigned_tcp_ports
   echo Sessions without assigned Udp Ports: $session_without_assigned_udp_ports
done

echo -------------------------------&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and simple script for send stats to predefined syslog server:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
# Gaia 77.10

state=`cphaprob stat | grep local.*Active`

if [ "$state" ]; then

        ts_list=( `pdp connections ts | grep -P "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"` )

        for ts in "${ts_list[@]}"
        do
           active_session=`pdp monitor ip $ts | grep Client | awk '{ print $1 }' | wc -l`
           session_without_assigned_tcp_ports=`pdp monitor ip $ts | grep -B 3 "Tcp Ports: -" | grep @ | awk '{ print $1 }' | wc -l`
           session_without_assigned_udp_ports=`pdp monitor ip $ts | grep -B 3 "Udp Ports: -" | grep @ | awk '{ print $1 }' | wc -l`
           echo "TSIA stats for $ts: ts=$ts active_session=$active_session session_without_assigned_tcp_ports=$session_without_assigned_tcp_ports session_without_assigned_udp_ports=$session_without_assigned_udp_ports" 2&amp;gt;&amp;amp;1 | logger -t CheckPoint -p local3.warning &amp;amp;
        done
fi&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Apr 2019 06:47:40 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Stats-of-Terminal-Server-Identity-Agent/m-p/51931#M3367</guid>
      <dc:creator>MK9</dc:creator>
      <dc:date>2019-04-26T06:47:40Z</dc:date>
    </item>
  </channel>
</rss>

