Ad Widget

Collapse

UserParameter and grep

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bimonitor
    Junior Member
    • Oct 2007
    • 13

    #1

    UserParameter and grep

    I am trying to monitor drive space for oracle asm volumes. I have created a script that writes a file to /tmp and is executed through cron to write the volume names and sizes. As long as only one line comes back, the UserParameter works fine, otherwise I get the Unsupported message in zabbix. I changed the grep pattern to look at the beginning of the line which works fine on the command line, but breaks all of the queries in UserParameter (Unsupported).

    Here are the two entries in the conf file.
    -----
    UserParameter=bi.asm[*],grep $2 $1 |sed 's/.*[\ \t]//'
    UserParameter=bi.asm2[*],grep ^$2 $1 |sed 's/.*[\ \t]//'
    -----
    $2 is the Volume name
    $1 is the file to search

    - bi.asm works until you get two of the same
    - bi.asm2 breaks always (apostrophies do not appear to help)

    Here is the content of the text file
    -----
    >cat /tmp/asmusage.txt
    ARCH 0
    DATA 71
    INDEX 49
    REDO_LOGS 84
    TEMP 42
    ZFRC_DATA 33
    ZFRC_INDEX 72
    -----

    Here is the "item" in zabbix
    -----
    bi.asm[/tmp/asmusage.txt, DATA]
    -----

    Any suggestions to get a consistent grep to work?
  • bimonitor
    Junior Member
    • Oct 2007
    • 13

    #2
    I didn't think this one would stump the group.... the gauntlet has been thrown

    Comment

    • nelsonab
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2006
      • 1233

      #3
      It's always interesting what will "stump" the group. :-) To me it looks correct and the only thing I can think of are escape characters ("\"). I remember reading about a year ago issues with some characters not formatting correctly unless they were escaped correctly.
      RHCE, author of zbxapi
      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

      Comment

      Working...