Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
securityonion-sostat: implement better error handling for zero packet…
Browse files Browse the repository at this point in the history
  • Loading branch information
dougburks committed Mar 15, 2019
1 parent 47daf0e commit ec2049b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
securityonion-sostat (20120722-0ubuntu0securityonion122) xenial; urgency=medium

* securityonion-sostat: implement better error handling for zero packet count Security-Onion-Solutions/security-onion#1464

-- Doug Burks <[email protected]> Fri, 15 Mar 2019 13:53:00 -0400

securityonion-sostat (20120722-0ubuntu0securityonion121) xenial; urgency=medium

* securityonion-sostat: change wiki links to docs Security-Onion-Solutions/security-onion#1454
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
securityonion-sostat (20120722-0ubuntu0securityonion122) xenial; urgency=medium
.
* securityonion-sostat: implement better error handling for zero packet count Security-Onion-Solutions/security-onion#1464
Author: Doug Burks <[email protected]>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- securityonion-sostat-20120722.orig/bin/sostat
+++ securityonion-sostat-20120722/bin/sostat
@@ -185,7 +185,11 @@ if [ -d /nsm/sensor_data ] && [ $NUM_INT
APP_NAME=`grep "Appl. Name" $i | awk '{print $4}'`
PF_TOT_IN=`grep "Tot Packets" $i | awk '{print $4}'`
PF_TOT_LOST=`grep "Tot Pkt Lost" $i | awk '{print $5}'`
- PF_PERCENT_LOST=$(echo "scale=2 ; $PF_TOT_LOST * 10/$PF_TOT_IN * 10" | bc)
+ if [[ -n $PF_TOT_LOST ]] && [[ $PF_TOT_LOST -gt 0 ]] ; then
+ PF_PERCENT_LOST=$(echo "scale=2 ; $PF_TOT_LOST * 10/$PF_TOT_IN * 10" | bc)
+ else
+ PF_PERCENT_LOST=0
+ fi
echo "Appl. Name: $APP_NAME"
echo "Tot Packets: $PF_TOT_IN"
echo "Tot Pkt Lost: $PF_TOT_LOST"
1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,4 @@ soup:-output-reminder-to-update-remaining-boxes-in-deployment-Security-Onion-Sol
soup:-check-for-lock-Security-Onion-Solutionssecurity-onion#1428
soup:-node-checking-master-for-updates-fails-if-master-has-1-update-Security-Onion-Solutionssecurity-onion#1434
securityonion-sostat:-change-wiki-links-to-docs-Security-Onion-Solutionssecurity-onion#1454
securityonion-sostat:-implement-better-error-handling-for-zero-packet-count-Security-Onion-Solutionssecurity-onion#1464

0 comments on commit ec2049b

Please sign in to comment.