0 Replies Latest reply on Jul 7, 2017 8:43 AM by vijay noc

    Multiple lines in Msg Output- Linux script monitor

    vijay noc

      Hello Thwackians,

       

      We have a script in linux script component monitoring that gives output in multiple lines for message field.

      But looks like Solarwinds supports only single line for the message field.

       

      #!/bin/bash

       

      scfile=/home/bpmrg/stale_count
      mount_list=/home/bpmrg/mountlist

       

              mount_check=$(cat /proc/mounts | grep -E 'autofs|nfs' | awk '{print $2}')
              echo "$mount_check" > $mount_list
              echo > $scfile
              for i in `cat $mount_list`
              do
              stat $i > /dev/null 2>> $scfile
              done
              stale_count=$(cat $scfile | grep "Stale" | wc -l)

       

              if [ $stale_count -ne 0 ]
              then
              stale_mount=$(cat $scfile | awk '{print $4}' | sed -e s/\'//g -e s/\`//g -e s/://g )
              echo "Statistic.NFS_mounts: $stale_count";
              echo -e "Message.NFS_mounts: NFS Stale mount found
              $stale_mount";
              else
              echo "Statistic.NFS_mounts: $stale_count";
              echo -e "Message.NFS_mounts: NFS Stale mount not found
              $stale_mount";
              fi
              rm -rf $scfile
      exit 0;

       

      Script Output :

       

      Statistic.NFS_mounts_count: 3
      Message.NFS_mounts: NFS Stale mount found
      /share
      /share1
      /mnt

       

      Since this output has multiple lines it shows as NA

       

      Script output in Component  monitor :

       

      Message.NFS_mounts:NA

      Statistic.NFS_mounts: 3

       

      Need an actual output as per the script :

       

      Statistic.NFS_stale_count: 3
      Message.NFS_mounts: NFS Stale mount found
      /share
      /share1
      /mnt

       

       

      how to get the multiple lines in the message field for linux/unix component monitoring...

       

      Thanks

      Vijay