Page 1 of 2

PoE on/off from cmdline

Posted: Wed Nov 16, 2016 12:34 pm
by mike99
Is the're a way to control PoE from the linux command line ? I would like to do a script to remote reset a Cambium ePMP via power cycle method.
Thanks

Re: PoE on/off from cmdline

Posted: Wed Nov 16, 2016 4:15 pm
by jakematic
I asked about this in September but didn't get an answer.
Maybe I stepped into a proprietary area ?

jakematic wrote:Thought the netonixctl command *might* be the proper way to control the port power at command line.

Tried but get i2c errors, and didn't want to break anything fiddling.

Code: Select all
admin@ws12:/usr/bin# netonixctl -h
Usage: netonixctl [-hv] [--pin <num>=<0|1>] | [--poe <port>=<off|24v|48v|48vh> ...] | [--poe_led <port>=<off|24v|48v|48vh> ...]
--poe: set PoE on ports
--poe_led: Set PoE leds on ports
--pin: Set GPIO pin
-v: Verbose
-h: Display this

admin@ws12:/www# netonixctl --poe_led 7=off
netonixctl[499]: i2c_read failed after 5 tries: Failed reading data to slave
netonixctl[499]: i2c_write failed after 5 tries: Failed writing data to slave
netonixctl[499]: i2c_read failed after 5 tries: Failed reading data to slave
netonixctl[499]: i2c_read failed after 5 tries: Failed reading data to slave

Re: PoE on/off from cmdline

Posted: Wed Nov 16, 2016 4:28 pm
by Eric Stern
To power cycle port 11:

touch /tmp/poe_override/11

This is the equivalent of doing a port bounce from the UI.

Re: PoE on/off from cmdline

Posted: Thu Nov 17, 2016 3:50 pm
by jakematic
Eric Stern wrote:To power cycle port 11:

touch /tmp/poe_override/11

This is the equivalent of doing a port bounce from the UI.



This is great Eric, thanks.

But is there no way to turn POE on/off from the cmdline ?
I understand there are diagnostics that should run etc... just would like something that I can automate.

Re: PoE on/off from cmdline

Posted: Thu Nov 17, 2016 4:20 pm
by sirhc
You do realize that there is a COMPLETE CLI that can do everything?

Do you have to drop to Linux level because the CLI via SSH can do everything?

Can you not script your system to execute CLI commands?

Re: PoE on/off from cmdline

Posted: Thu Nov 17, 2016 6:56 pm
by mike99
Thanks Eric,

I didn't have time to check this out but like jakematic, I really need to shut down port and not bounce it since, for resetting the radio, power must be turn off for 3~5 seconds. I had in mind to use sleep 4 unless I change port bounce time off to 4 seconds ?

Chris, maybe with expect but I think that most sysadmin are more familiar with sh or bash than expect. Personnaly, I never use expect even if I know about it, how it's work, etc.

Re: PoE on/off from cmdline

Posted: Fri Nov 18, 2016 9:07 am
by jakematic
sirhc wrote:You do realize that there is a COMPLETE CLI that can do everything?

Do you have to drop to Linux level because the CLI via SSH can do everything?

Can you not script your system to execute CLI commands?



The trouble is if you want to automate anything you get dropped to Linux on a password-less ssh by adding your key to /etc/dropbear/authorized_keys

Code: Select all
root@ubu:/Fedora# ssh admin@192.168.0.30 show config
ash: show: not found


root@ubu:/Fedora# ssh admin@192.168.0.30 df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 5760 5760 0 100% /
/dev/root 5760 5760 0 100% /rom
/dev/mtdblock6 4352 1272 3080 29% /jffs
mini_fo:/jffs 5760 5760 0 100% /



Open to suggestions on other ways to do it.

Re: PoE on/off from cmdline

Posted: Fri Nov 18, 2016 10:52 am
by Eric Stern
1. Grab the config (scp /www/config.json)
2. Modify the config locally to turn off PoE (this should be easy to figure out)
3. Upload the new config (scp)
4. Apply the new config (cd /www; php-cli config.php --apply)

Re: PoE on/off from cmdline

Posted: Fri Nov 18, 2016 2:06 pm
by jakematic
Well.... sed ain't gonna work on that file! :shock:

Re: PoE on/off from cmdline

Posted: Fri Nov 18, 2016 2:26 pm
by sirhc
jakematic wrote:Well.... sed ain't gonna work on that file! :shock:


I too would NOT mess with the JASON file as any format error can bonk the switch.

This has been a source of heated debate internally that Eric needs to put in routines to deal with corrupted or improperly formatted config files but as far as I know once it hits something incorrect it just stops reading the config file. :headb: