Opened 10 years ago

Last modified 5 years ago

#43644 assigned defect

xymon-client port on Mac OS X cannot handle volumes with spaces in name

Reported by: MacPorts.ORG@… Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: chrstphrchvz (Christopher Chavez)
Port: xymon-server xymon-client

Description

Many Macs have hard drives with a default name like "Macintosh HD". They also may have a Time Machine volume with a name like "Time Machine" or "Time Machine Backups".

The present Mac port of the Xymon client code does not deal well with this.

Only the first element (e.g. "/Volumes/Macintosh" or "/Volumes/Time") is emitted from the "xymonclient-darwin.sh" script.

This is present not only in the Xymon 4.3.10 code in the current MacPorts port but also in the current Xymon 4.3.17 mainline release.

This makes it very difficult to use Xymon in a work environment where one might like to monitor Macs as well as more common (Linux, Solaris) systems.

I am creating this ticket in hopes that Xymon author Henrik Størner and Xymon MacPorts port maintainer François Claire can somehow find a way to fix this :-)

Please see attachment for partial fix and suggestion for changing the df processing section to one that is iterative over the output of the the original df.

Attachments (1)

Xymon_MacPorts_ticket.txt (2.1 KB) - added by MacPorts.ORG@… 10 years ago.
Script "df" sub-section output and proposed partial fix

Download all attachments as: .zip

Change History (11)

Changed 10 years ago by MacPorts.ORG@…

Attachment: Xymon_MacPorts_ticket.txt added

Script "df" sub-section output and proposed partial fix

comment:1 Changed 10 years ago by MacPorts.ORG@…

This is still a work in progress obviously, but here are the changes I'm working with at the moment.

I don't understand some of the original code (why use column to columnize it?), but at least at this point the "[df]" and "[inode]" outputs look 'correct'.

The real problem is getting the server to interpret the raw data correctly and match it to my analysis.cfg rules ... I don't know where in the server code that's done.

macmini:/<4>client/bin % diff -ru xymonclient-darwin.sh.dist xymonclient-darwin.sh
--- xymonclient-darwin.sh.dist  2012-08-02 08:51:05.000000000 -0700
+++ xymonclient-darwin.sh       2014-05-09 03:45:09.000000000 -0700
@@ -26,26 +26,36 @@
 echo "[who]"
 who
 
-FILESYSTEMS=`mount | grep -v nobrowse | awk '{print $3}'`
+#FILESYSTEMS=`mount | grep -v nobrowse | awk '{print $3}'`
+#FILESYSTEMS=`mount | grep -v nobrowse | sed -e 's/^.* on \(.*\) [(].*$/\1/g'`
 echo "[df]"
-set $FILESYSTEMS
-(df -H $1; shift
- while test $# -gt 0
- do
-   df -H $1 | tail -1
-   shift
- done) | column -t -s " " | sed -e 's!Mounted *on!Mounted on!'
+#set $FILESYSTEMS
+#(df -H $1; shift
+# while test $# -gt 0
+# do
+#   df -H $1 | tail -1
+#   shift
+# done) | column -t -s " " | sed -e 's!Mounted *on!Mounted on!'
+
+# XXX [GKE 2/26/2014]
+#df -h -t hfs,ntfs | column -t -s " " | sed -e 's!Mounted *on!Mounted on!'
+df -P -h -t hfs,ntfs
 
 echo "[inode]"
-set $FILESYSTEMS
-(df -i $1; shift
- while test $# -gt 0
- do
-   df -H $1 | tail -1
-   shift
- done) | awk '
-NR<2{printf "%-20s %10s %10s %10s %10s %s\n", $1, "itotal", $6, $7, $8, $9} 
-(NR>=2 && $6>0) {printf "%-20s %10d %10d %10d %10s %s\n", $1, $6+$7, $6, $7, $8, $9}'
+#set $FILESYSTEMS
+#(df -i $1; shift
+# while test $# -gt 0
+# do
+#   df -H $1 | tail -1
+#   shift
+# done) | awk '
+#NR<2{printf "%-20s %10s %10s %10s %10s %s\n", $1, "itotal", $6, $7, $8, $9} 
+#(NR>=2 && $6>0) {printf "%-20s %10d %10d %10d %10s %s\n", $1, $6+$7, $6, $7, $8, $9}'
+
+# XXX [GKE 2/26/2014]
+df -h -i -t hfs,ntfs | awk '
+NR<2{printf "%-20s %10s %10s %10s %10s %s\n", $1, "itotal", $6, $7, $8, $9}
+(NR>=2 && $6>0) {printf "%-20s %10d %10d %10d %10s %s %s %s %s\n", $1, $6+$7, $6, $7, $8, $9, $10, $11, $12}'
 
 echo "[mount]"
 mount

comment:2 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: xymon removed
Milestone: MacPorts Future
Owner: changed from macports-tickets@… to fclaire@…

comment:3 Changed 10 years ago by fclaire@…

Thanks for reporting the problem and proposing a fix. I'll have a look at it.

I might as well update the xymon macports to 4.3.17.

comment:4 Changed 10 years ago by MacPorts.ORG@…

Merci François :-)

I believe there are two issues here:

(1) Why does this xymonclient-darwin.sh script output what it does, with all the awk massaging etc., instead of just the "raw" df/df -i output. What does the server side expect as input?

(2) Where in the server-side code is this output processed? Because even with my current diffs above, nothing I have tried RE-wise on the server side gets it to recognize a partition/volume name with spaces in it.

In other words, this entry

HOST=macmini
    DISK    %(?-i)^.*/Volumes/Time 98 99
    INODE   %(?-i)^.*/Volumes/Time 98 99

works to suppress the alerts; this

HOST=macmini
    DISK    %(?-i)^.*/Volumes/Time\sMachine\sBackups 98 99
    INODE   %(?-i)^.*/Volumes/Time\sMachine\sBackups 98 99

does not. The latter results in an alert reading

red Fri May  9 12:03:20 PDT 2014 - Filesystems NOT ok
&red <!-- ID=/Volumes/Time Machine Backups  --> /Volumes/Time Machine Backups  (97% used) has reached the PANIC level (95%)
&yellow <!-- ID=/Volumes/Macintosh HD   --> /Volumes/Macintosh HD   (93% used) has reached the WARNING level (90%)

Filesystem               itotal      iused      ifree     %iused Mounted
/dev/disk0s2          237145994  178215621   58930373        75% /   
/dev/disk1s2          244106666  237239564    6867102        97% /Volumes/Time Machine Backups 
/dev/disk0s4            4347580     101211    4246369         2% /Volumes/BOOTCAMP   
/dev/disk2s2          176632084  164649661   11982423        93% /Volumes/Macintosh HD  
/dev/disk2s4            9538076      81941    9456135         1% /Volumes/BOOTCAMP 1  

so even though the df output is 'correct', something on the server end is not matching the volume string. I don't know where that code is. (I also don't understand where the "<!-- ID="/"-->" comes from.)

(In case that output looks confusing, I have the machine my current one replaced connected via FireWire Target Mode.)

comment:5 Changed 10 years ago by mf2k (Frank Schima)

Port: xymon removed

comment:6 Changed 10 years ago by fclaire@…

Hi,

I plan to update the xymon ports to the soon-to-be-released 4.3.18.

comment:7 Changed 8 years ago by fclaire@…

Hi,

I've created update requests tickets: #50720 and #50722.

Version 4.3.26 of xymon is putting underscore char instead of space in volume names.

Upgrading to that version should solve this problem.

comment:8 Changed 5 years ago by chrstphrchvz (Christopher Chavez)

The port has since been updated to 4.3.26. Is this issue resolved?

comment:9 Changed 5 years ago by chrstphrchvz (Christopher Chavez)

Cc: chrstphrchvz added

comment:10 Changed 5 years ago by kurthindenburg (Kurt Hindenburg)

Owner: fclaire@… deleted
Status: newassigned
Note: See TracTickets for help on using tickets.