SAL / Facter Help - A few additional items to monitor for a school environment

120 views
Skip to first unread message

Adrian Burgess

unread,
Oct 2, 2014, 7:11:12 PM10/2/14
to sal-d...@googlegroups.com
Loving Sal and Facter - we are in the process of implementing both into the management of staff and student machines in a high school.
We have added Graham's additional mac factor scripts and they are working like a charm (really appreciate the battery cycle count)

There are a few additional items we wish to track and are putting them out there to see if the community has tackled (or hopefully solved)

1. Ability to pull the bluetooth MAC address
2. Ability to list local volume names and also size information (our SOE has an OS partition and a DATA partition - would like to track both of these)
3. Time since last Time Machine backup (for staff laptops)
4. Ability to check if a firmware password is currently set (check to see if students have ability to bypass security)

Thanks in advance for any advice. 

Graham Gilbert

unread,
Oct 3, 2014, 1:36:54 AM10/3/14
to Adrian Burgess, sal-d...@googlegroups.com
Your first task is finding a way to do it on the command line. Once you've got that far, it's not too difficult to convert it into ruby for facter.

Graham Gilbert
Sent from my iPhone


--
You received this message because you are subscribed to the Google Groups "sal-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sal-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jonathan Cohen

unread,
Nov 6, 2014, 7:08:31 PM11/6/14
to sal-d...@googlegroups.com
I'm digging into this issue as well, also a HS environment.  I'm early in the process but I can use df to pull the information.  Prior to Sal we were just running this occasionally with ARD to pull client reports.

df -h /Volumes/[your drive name] | awk '{print$5}' | grep %

this will output a percentage of free space on the named volume.


I'm now trying to build my custom fact to add to facter:

#dataHD_space.rb
Facter.add(:dataHD_space) do
  confine :kernel => :darwin
  setcode do
    %x{'df -h /Volumes/Data HD/ | awk '{print$5}' | grep %'}
  end 
 end

I then used this to create a new .rb file called volume.rb

when I launch facter I get this:

$ facter

~/.facter/facts.d/dataHD_space.rb: line 2: syntax error near unexpected token `:dataHD_space'

~/.facter/facts.d/dataHD_space.rb: line 2: `Facter.add(:dataHD_space) do'

I feel like I am missing something with my custom fact setup.

Graham Gilbert

unread,
Nov 6, 2014, 8:51:22 PM11/6/14
to Jonathan Cohen, sal-d...@googlegroups.com
Remember that Sal can pull data from Munki conditions as well as Facter. If you're happier working in Bash, you can use that with Munki conditions. You can also implement an external Fact https://docs.puppetlabs.com/facter/2.3/custom_facts.html#viewing-fact-values

Graham


Sent from Mailbox


--

Daniel Hazelbaker

unread,
Nov 6, 2014, 9:36:16 PM11/6/14
to sal-d...@googlegroups.com
I have a time machine plug-in that I wrote in bash shell script.  It can be found here: https://github.com/cabal95/sal-plugins/tree/master/timemachine

The client/timemachine_info.sh file needs to be installed on the client into /etc/facter/facts.d/ (don't forget to make it executable, you may have to create this folder).

The 'server' folder should be renamed to 'timemachine' and then placed in your sal plugins folder on the server.

The plugin will show machines that have TM configured and not configured as well as the machines that have been backed in <7 days, 7-28, and >28 days (I think those were the numbers).

Daniel


On Thursday, October 2, 2014 4:11:12 PM UTC-7, Adrian Burgess wrote:

Graham Gilbert

unread,
Nov 7, 2014, 2:35:45 AM11/7/14
to Daniel Hazelbaker, sal-d...@googlegroups.com
Hi Daniel,

Would you be up for me forking this to the salsoftware org and giving you commit rights so we keep all these in the same place? You got a shout out today for the historical facts in my MacTech presentation btw:)

Cheers,
G


Sent from Mailbox


--

Daniel Hazelbaker

unread,
Nov 7, 2014, 12:59:40 PM11/7/14
to sal-d...@googlegroups.com, danielha...@gmail.com
Graham,

  Sure thing.  Just let me know what I need to do to make all that functional.

Daniel

Graham Gilbert

unread,
Nov 7, 2014, 1:05:26 PM11/7/14
to Daniel Hazelbaker, sal-d...@googlegroups.com
I've forked the repo and given you commit access to it. I'd just point people towards the new one in the original's readme.

Cheers
G

b...@benbass.com

unread,
Nov 12, 2014, 4:03:23 PM11/12/14
to sal-d...@googlegroups.com
Hi Daniel.

I am trying to get the Time Machine one to work with the latest Sal and I am running into issues.  I have the plugin showing up on the server, however I don't have any data coming in to it.  I created the /etc/facter/facter.d/ directory, copied the client/timemachine_info.sh into this directory and made it executable.  I can call it directly from the command line on the client, and get what seems to be an appropriate output.  However sal doesn't seem to have any of that data in the Facter toggle for the computer that has the timemachine_info.sh installed.  I honestly don't know where to look to see where the failure could be.

Any ideas or hints?  I have Facter 2.3.0 installed and the test machine is running 10.8.5.  The built in facters and Graham's plugins are working properly.

Thank you!

-Ben Bass

Daniel Hazelbaker

unread,
Nov 12, 2014, 5:05:06 PM11/12/14
to sal-d...@googlegroups.com
On the client did you put it in /etc/facter/facts.d/ or /etc/facter/facter.d/ ?  It should be the first one, /etc/facter/facts.d/

If it is in the right spot and you just mis-typed it in the e-mail, try running 'sudo facter' and see if you get any of the timemachine_XXX facts showing up (it has to be sudo or it won't run the scripts)

Daniel

Graham Gilbert

unread,
Nov 12, 2014, 5:13:08 PM11/12/14
to b...@benbass.com, sal-d...@googlegroups.com
Or if you want to run it exactly as Sal does, sudo facter -p


Sent from Mailbox


--

Ben Bass

unread,
Nov 12, 2014, 7:55:28 PM11/12/14
to sal-d...@googlegroups.com
And now to the list since I wound up replying directly to Daniel…

So it seems that yes I just misspelled (but was consistent with my misspelling) and my tired eyes last night couldn’t differentiate /etc/facter/facter.d/ and /etc/facter/facts.d/.

Oddly, it works when you put them in the correct directory.  

Thank you for the help Daniel and Graham!

-----------------------------------------------------------
Ben Bass, ACTC (10.6), ACSP (10.9) MTC
Specialist: Mac OSX Security & Mobility
Senior Macintosh Consultant
(917) 536-0998
b...@benbass.com

Pepe Silvia

unread,
Sep 14, 2017, 9:15:24 AM9/14/17
to sal-discuss

Hey!  I'm still using this plugin in 2017, tyvm Daniel and Graham!  Not only has it been a lifesaver at work, but reading the code has helped me learn Python.

I've noticed that "Machines backed up more than 28 days ago" lists computers that haven't been backed up in > 30 days AND computers that dont have TimeMachine setup at all.  I have been trying to change that to exclude machines that have TM turned off.  

Below are lines 77-81 from https://github.com/cabal95/sal-plugins/blob/master/timemachine/server/timemachine.py that I'm trying to understand better:



elif data == 'recent_error':
setA = machines.filter(fact__fact_name='timemachine_lastsnapshot', fact__fact_data__lt=time_month)
setB = machines.filter(fact__fact_name='timemachine_configured', fact__fact_data=1).exclude(fact__fact_name='timemachine_lastsnapshot')
machines = setA | setB
title = 'Machines backed up more than 28 days ago' machines = setA | setB - I'm not familiar with the | operator in Python, does this mean setA OR setB?

fact__fact_data__lt - is this a function defined elsewhere, or a variable... what does it represent?  fact data limit?  fact data length?  Ditto for fact__fact_data__gte.





I'm hoping once I can understand the code better I can make it so recent_error can exclude machines with TM turned off, those can go in the notconfigured section above.  Anyhow, thanks for reading this far, and thanks in advance for any input!
 

Graham Gilbert

unread,
Sep 14, 2017, 12:14:08 PM9/14/17
to sal-d...@googlegroups.com


As an aside, I’m pretty sure Daniel doesn’t use these anymore, so his plugins could do with a new maintainer - offers to volunteer are gratefully received!

Sent from my iPhone

From: sal-d...@googlegroups.com <sal-d...@googlegroups.com> on behalf of Pepe Silvia <pstoj...@gmail.com>
Sent: Thursday, September 14, 2017 6:15:23 AM
To: sal-discuss
Subject: Re: [sal-discuss] Re: SAL / Facter Help - A few additional items to monitor for a school environment
 
--

Pepe Silvia

unread,
Sep 16, 2017, 11:05:12 AM9/16/17
to sal-discuss
Thanks Graham, these links are most helpful!  Will let you know how it goes!  
Reply all
Reply to author
Forward
0 new messages