GUI Status "Light"

Status
Not open for further replies.

JimmyUk

Dabbler
Joined
Sep 6, 2014
Messages
18
Hi,

I'm sure I'm not alone when I say the 1st thing I do when i login to the GUI is look at the (hopefully) green Status in the top right. More often than not I'll login to one of the NAS's just to check-up on it's status.

I just wondered if there was a command, script or API that could return the colour of the light? I quite simply want to look at the possibilities of an RGB LED mounted on the NAS boxes so that at a glance I can see it's status. Once I find a way of getting this data I think I could do the reset, possibly controlled by an ardunio nano board or the like, through the serial interface or via network.

any feedback will be appreciated.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,681
I love the way you think, let me just say that right now.

It's driven by ${URL}/admin/alert/status/ which is usually followed by some cachebusting and returns "OK" if all is OK (or WARN or CRIT). It looks to me like that's driven by the code in freeadmin/site.py which is too Python-y for me to want to spend any time on.

You'll have to figure out authentication, or maybe the FreeNAS API has a hook to get the information, which I haven't bothered to check.
 

JimmyUk

Dabbler
Joined
Sep 6, 2014
Messages
18
Thanks jgreco that was really useful, I didn't know FN has any sort of http links like that.
Authentication may be a problem there as you mentioned. I'm not familiar with python nor with 'hooks' so will have to do some research. it's a good start tho jgreco
 

JimmyUk

Dabbler
Joined
Sep 6, 2014
Messages
18
Kind of a bump post this, I'm still trying to work this one out. Has anyone got enough python knowledge to work out how to get the status without authentication from the shell?

I have tried the following as status.py
Code:
import requests

print requests.get(
    'http://localhost/api/v1.0/system/alert/',
    auth=('root', '<ROOT PASSWORD>'),
)


but all I get is:

[root@freenas] ~# python status.py
<Response [200]>
 
Last edited:

JimmyUk

Dabbler
Joined
Sep 6, 2014
Messages
18
Slight update.

got a more descriptive response with the below

Code:
import requests
import json

test = requests.get(
    'http://localhost/api/v1.0/system/alert/',
    auth=('root', '**********'),
headers = {'content-type': 'application/json'}
)
print test.content


now time to play with python and get an output to the serial port :S
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,210
That's a cool idea. I'll be following this to see if you figure out a way to do it and write a how-to so that even a dummy could do it.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,681
For those who want to sit the thing in a corner, yeah, that's kinda interesting.
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,449
Can it be used as a flashlight to find lost files :)?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,681
No, you need the industrial strength laser cutter for that.
 
Status
Not open for further replies.
Top