Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Thu Mar 28, 2024 8:32 pm

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
PostPosted: Tue Aug 26, 2014 1:44 am 
Offline
Newbie

Joined: Mon Jan 06, 2014 9:30 pm
Posts: 5
Location: Germany / Berlin
I found a bug in the current OSX Script 1.4. I got a parse error when the script checked the hard drive size. I found out that the bc command get two numbers with a comma and the command fails. So my solution is to include the commands with a replacment of the comma to a point. Something like that should it be:

partition_size=`echo "$vol" | cut -d":" -f2 | cut -d" " -f2 | sed 's/^ *//g' | sed 's/ *$//g' |[color=#FF0000] tr , .[/color]`
partition_free_space=`echo "$vol" | cut -d":" -f2 | cut -d" " -f2 | sed 's/^ *//g' | sed 's/ *$//g' |[color=#FF0000] tr , .[/color]`
hard_drive_size=`echo "$line" | cut -d":" -f2 | cut -d" " -f2 | sed 's/^ *//g' | sed 's/ *$//g' | [color=#FF0000]tr , .[/color]`

Note: There are multiple sections where you have to add the command.


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 20, 2014 6:18 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
When I made this change, the script stopped working (it wouldn't get a successful audit). The error is

tr,.: command not found

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 20, 2014 7:22 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
Probably "tr , ." not "tr,.". Lost some spaces in there.


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 25, 2014 6:06 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
Ok, with those extra spaces in there, the script doesn't work anymore. Here is the error


Attachments:
OSX-FAIL.JPG
OSX-FAIL.JPG [ 44.71 KiB | Viewed 13396 times ]

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices
Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 25, 2014 6:23 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
I should have said I'm totally guessing and suck at CLI stuff.

How about if you try "tr ',' '.'" instead?

[code]partition_size=`echo "$vol" | cut -d":" -f2 | cut -d" " -f2 | sed 's/^ *//g' | sed 's/ *$//g' | tr ',' '.'`[/code]

Also, I don't have a MacOS machine to test so I'm not even sure what the root problem is. I would guess that it is a localization thing where Oeser's computer is reporting "3000,00" instead of "3000.00" which then breaks a later calculation.


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 25, 2014 6:36 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
Although now that I actually look at the error message I wonder how adding the tr stuff could have caused the given error.


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 26, 2014 5:40 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
I probably hosed the script when trying to edit it in OSX which seems to have the most lame text editor. Doesn't even list what line you are on. I'm going to try to find some time to start over. Here is what I get for disk info with the current script before I blew it up trying to make these edits. I wonder if oeser could post his script with his changes?


Attachments:
OSX-Disk.JPG
OSX-Disk.JPG [ 33.82 KiB | Viewed 13386 times ]

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices
Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 26, 2014 7:33 am 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1964
Location: Brisbane, Australia
My OSX disks looks like the below.
BTW - Sublime Text is a great editor and available on OSX, Linux and Windows...

[attachment=0] osx_disks.png
osx_disks.png [ 221.81 KiB | Viewed 13384 times ]

_________________
Support and Development hours available from [url=https://opmantek.com]Opmantek[/url].
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 27, 2014 5:08 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
I had a chance to try again with the clean 1.4 script. I also audited another OSX server. Here is what I found:

- system running OSX 10.9.5 still has blank disk space info (same as the pic I posted previously)

- system running OSX 10.8.5 audited fine, got similar results to what Mark posted here

I haven't tried to edit the script again yet with these changes, but I did install Sublime text (thanks for that tip, Mark) looks MUCH better that the default text editor.

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 29, 2014 9:28 am 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1964
Location: Brisbane, Australia
Make sure you run the script as root (use sudo).
Check out the extensions using PackageControl (for SublimeText) at [url]https://sublime.wbond.net/[/url].

_________________
Support and Development hours available from [url=https://opmantek.com]Opmantek[/url].
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 18, 2014 5:19 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 205
Location: Massachusetts
Just audited using version 1.5.2 and OSX 10.8.5 works fine, the disk info is accurate. With OSX 10.9.5 the system audits, but the disk info isn't showing, and there is an error concerning volumes (see attached)


Attachments:
volumes.JPG
volumes.JPG [ 90.86 KiB | Viewed 12901 times ]

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices
Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 18, 2014 9:36 am 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1964
Location: Brisbane, Australia
I have fixed the undefined variable $volumes. It will be in the 1.5.3 (next) release.

I've also added [code]| sed 's/,/./g'[/code] to the end of any code (in audit_osx.sh) that retrieves a number that we then need to calculate. Again, this will be in 1.5.3.

_________________
Support and Development hours available from [url=https://opmantek.com]Opmantek[/url].
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group