Hello

 

It's me again.

I need to read some SNMP data which are in HEX format, like this XX XX XX XX
XX XX XX XX.

I created a bash script which works perfectly when launched form console.

But when it is put into OpsView as an active plugin - there is a problem.

A command to print a hex value in decimal is not executed.

 

Here is a part of the script:

 

TXOUTPUTORIG=`snmpget -v 1 -c $2 $1
SNMPv2-SMI::experimental.94.4.5.1.6.16.0.0.5.30.52.186.106.0.0.0.0.0.0.0.0.1
-O v | sed 's/Hex-STRING: //'`

TXOUTPUTHEX=`echo $TXOUTPUTORIG | sed 's/ //g'`

TXOUTPUTDEC=`echo $(( 16#$TXOUTPUTHEX ))`

echo hex: $TXOUTPUTHEX, dec: $TXOUTPUTDEC - end

echo $TXOUTPUTDEC >
/usr/local/nagios/libexec/check_Brocade_data/check_snmp_Brocade_$1_$3_dataTX
1.txt

 

 

RXOUTPUTORIG=`snmpget -v 1 -c $2 $1
SNMPv2-SMI::experimental.94.4.5.1.7.16.0.0.5.30.52.186.106.0.0.0.0.0.0.0.0.1
-O v | sed 's/Hex-STRING: //'`

RXOUTPUTHEX=`echo $RXOUTPUTORIG | sed 's/ //g'`

RXOUTPUTDEC=`echo $(( 16#$RXOUTPUTHEX ))`

echo hex: $RXOUTPUTHEX, dec: $RXOUTPUTDEC - end

echo $RXOUTPUTDEC >
/usr/local/nagios/libexec/check_Brocade_data/check_snmp_Brocade_$1_$3_dataRX
1.txt

 

The fourth line is purely for debugging

Second one removes spaces from  hex number

Third line should put into variable TXOUTPUTDEC the value of TXOUTPUTHEX
printed in decimal.

 

This works great in the console.

But when its run by OpsView I get this on the webpage:

 

hex: 0000138B0DF2A858, dec: - end
hex: 00000F6FC5317E1B, dec: - end

 

The TXOUTPUTDEC and TXOUTPUTDEC are empty variables.

While TXOUTPUTHEX and RXOUTPUTHEX are fine.

 

 

How can I fix this??

 

------------------------------------

 

Regards

 

Michal Zyzak

Administrator  img_CCNA_1

+48 71 3761 689

+48 665 351 639

 

TIM S.A.

ul. E. Kwiatkowskiego 24

55-011 Siechnice

Poland

 

----------------------------------------------------------------------------
--------

This email and any attachments are intended only for the named recipient and
may 

contain confidential and/or privileged material.

Any unauthorized copying, dissemination or other use by a person other than 

the named recipient of this communication is prohibited.

If you received this in error or are not named as a recipient, please notify
the sender 

and destroy all copies of this email immediately.

----------------------------------------------------------------------------
--------

 

<<image002.jpg>>

_______________________________________________
Opsview-users mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-users

Reply via email to