Dear Expert
When checking Service Status (IfOperStatus) in the result there is If-Index which is very helpful info, the same way we want to display in the Service Bandwidth (check_rrdtraf).
I tried as below but its giving full path of the file which is clumsy
echo -n "$FILE OK - Current BW
I want to show something as below if FILE = var/lib/mrtg/tst-7200-1_235.rrd
(ifindx 235) OK - Current BW <<< including braces(brackets) so ifINDEX will show as a separate entity.
need to manipulate $FILE and extract substring between _ and .
I tried googling but not very successful...Appreciate your solution (string manipulation).
Regards
ifIndex to be display in Bandwidth check
ifIndex to be display in Bandwidth check
Zajil NMS
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: ifIndex to be display in Bandwidth check
Can you share which plugin you are trying to modify?
Re: ifIndex to be display in Bandwidth check
Dear scottwilkerson
I have mentioned, once again
check_xi_service_mrtgtraf
$USER1$/check_rrdtraf -f /var/lib/mrtg/$ARG1$ -w $ARG2$ -c $ARG3$ -l $ARG4$
$ARG1$=tst-7200-1_235.rrd
Previously I mentioned only part of last line, now please find some of last lines of CHECK_RRDTRAF
more /usr/local/nagios/libexec/check_rrdtraf
echo "out=$(echo "scale=6; ($VALUEOUT/$SDIVOUT)"| bc)$SLABELOUT""b/s;$OUTWARN;$OUTCRIT"
exit $STATE_WARNING
else
echo -n "OK - Current BW in: $(echo "scale=$SCALE; ($VALUEIN/$SDIVIN)"| bc)"$SLABELIN"bps Out: $(echo "scale=
$SCALE; ($VALUEOUT/$SDIVOUT)"| bc)"$SLABELOUT"bps"
echo -n "|in=$(echo "scale=6; ($VALUEIN/$SDIVIN)"| bc)$SLABELIN""b/s;$INWARN;$INCRIT "
echo "out=$(echo "scale=6; ($VALUEOUT/$SDIVOUT)"| bc)$SLABELOUT""b/s;$OUTWARN;$OUTCRIT"
exit $STATE_OK
Regards
I have mentioned, once again
check_xi_service_mrtgtraf
$USER1$/check_rrdtraf -f /var/lib/mrtg/$ARG1$ -w $ARG2$ -c $ARG3$ -l $ARG4$
$ARG1$=tst-7200-1_235.rrd
Previously I mentioned only part of last line, now please find some of last lines of CHECK_RRDTRAF
more /usr/local/nagios/libexec/check_rrdtraf
echo "out=$(echo "scale=6; ($VALUEOUT/$SDIVOUT)"| bc)$SLABELOUT""b/s;$OUTWARN;$OUTCRIT"
exit $STATE_WARNING
else
echo -n "OK - Current BW in: $(echo "scale=$SCALE; ($VALUEIN/$SDIVIN)"| bc)"$SLABELIN"bps Out: $(echo "scale=
$SCALE; ($VALUEOUT/$SDIVOUT)"| bc)"$SLABELOUT"bps"
echo -n "|in=$(echo "scale=6; ($VALUEIN/$SDIVIN)"| bc)$SLABELIN""b/s;$INWARN;$INCRIT "
echo "out=$(echo "scale=6; ($VALUEOUT/$SDIVOUT)"| bc)$SLABELOUT""b/s;$OUTWARN;$OUTCRIT"
exit $STATE_OK
Regards
Zajil NMS
Re: ifIndex to be display in Bandwidth check
You will need to use some sed/awk magic to get that value out. You will essentially be looking for an underscore, some number of digits, then ".rrd" and pulling out the digits.
Former Nagios employee
Re: ifIndex to be display in Bandwidth check
Thanks tmcdonald
done.....Please close the case.
ZUSSTRNG=`echo $FILE| cut -d'_' -f 2`
ZUSSTRNG=`echo $ZUSSTRNG| cut -d'.' -f 1`
Regards
done.....Please close the case.
ZUSSTRNG=`echo $FILE| cut -d'_' -f 2`
ZUSSTRNG=`echo $ZUSSTRNG| cut -d'.' -f 1`
Regards
Zajil NMS