diff --git a/bin/sostat b/bin/sostat index faa94fa..b03faea 100755 --- a/bin/sostat +++ b/bin/sostat @@ -235,7 +235,7 @@ if [ -d /nsm/sensor_data ] && [ $NUM_INTERFACES -gt 0 ]; then cat $TMP | \ sed 's/[a-z]*=//g' | \ awk '{ drop += $4 ; link += $5 } \ - END { if ( drop >=1 && link >=1 ) printf("%f\n", ((drop/NR) / (link/NR)) * 100); else print("No packets seen. Please check SPAN port and/or cabling."); }' + END { if ( link >=1 ) printf("%f\n", ((drop/NR) / (link/NR)) * 100); else print("No packets seen."); }' echo cat $TMP echo diff --git a/debian/changelog b/debian/changelog index 6092237..95a56b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +securityonion-sostat (20120722-0ubuntu0securityonion123) xenial; urgency=medium + + * securityonion-sostat: awk division error when Bro doesn't report stats correctly Security-Onion-Solutions/security-onion#817 + + -- Doug Burks Wed, 20 Mar 2019 09:03:12 -0400 + securityonion-sostat (20120722-0ubuntu0securityonion122) xenial; urgency=medium * securityonion-sostat: implement better error handling for zero packet count Security-Onion-Solutions/security-onion#1464 diff --git a/debian/patches/securityonion-sostat:-awk-division-error-when-Bro-doesn't-report-stats-correctly-Security-Onion-Solutionssecurity-onion#817 b/debian/patches/securityonion-sostat:-awk-division-error-when-Bro-doesn't-report-stats-correctly-Security-Onion-Solutionssecurity-onion#817 new file mode 100644 index 0000000..832ce01 --- /dev/null +++ b/debian/patches/securityonion-sostat:-awk-division-error-when-Bro-doesn't-report-stats-correctly-Security-Onion-Solutionssecurity-onion#817 @@ -0,0 +1,41 @@ +Description: + 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-0ubuntu0securityonion123) xenial; urgency=medium + . + * securityonion-sostat: awk division error when Bro doesn't report stats correctly Security-Onion-Solutions/security-onion#817 +Author: Doug Burks + +--- +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: , +Bug: +Bug-Debian: https://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- securityonion-sostat-20120722.orig/bin/sostat ++++ securityonion-sostat-20120722/bin/sostat +@@ -232,9 +232,10 @@ if [ -d /nsm/sensor_data ] && [ $NUM_INT + echo "${underline}Bro${normal}:" + echo + echo -n "Average packet loss as percent across all Bro workers: " +- cat $TMP | sed \ +- 's/[a-z]*=//g' | awk '{ drop += $4 ; link += $5 } \ +- END { printf("%f\n", ((drop/NR) / (link/NR)) * 100) }' ++ cat $TMP | \ ++ sed 's/[a-z]*=//g' | \ ++ awk '{ drop += $4 ; link += $5 } \ ++ END { if ( link >=1 ) printf("%f\n", ((drop/NR) / (link/NR)) * 100); else print("No packets seen."); }' + echo + cat $TMP + echo diff --git a/debian/patches/series b/debian/patches/series index 5b5f6e8..fd6507e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -117,3 +117,4 @@ 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 +securityonion-sostat:-awk-division-error-when-Bro-doesn't-report-stats-correctly-Security-Onion-Solutionssecurity-onion#817