PoE on/off from cmdline

User avatar
mike99
Associate
Associate
 
Posts: 837
Joined: Tue Nov 25, 2014 10:53 am
Location: Quebec, Canada
Has thanked: 95 times
Been thanked: 245 times

PoE on/off from cmdline

Wed Nov 16, 2016 12:34 pm

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

User avatar
jakematic
Experienced Member
 
Posts: 168
Joined: Thu Jul 14, 2016 8:15 am
Location: NC USA
Has thanked: 362 times
Been thanked: 87 times

Re: PoE on/off from cmdline

Wed Nov 16, 2016 4:15 pm

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

User avatar
Eric Stern
Employee
Employee
 
Posts: 532
Joined: Wed Apr 09, 2014 9:41 pm
Location: Toronto, Ontario
Has thanked: 0 time
Been thanked: 130 times

Re: PoE on/off from cmdline

Wed Nov 16, 2016 4:28 pm

To power cycle port 11:

touch /tmp/poe_override/11

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

User avatar
jakematic
Experienced Member
 
Posts: 168
Joined: Thu Jul 14, 2016 8:15 am
Location: NC USA
Has thanked: 362 times
Been thanked: 87 times

Re: PoE on/off from cmdline

Thu Nov 17, 2016 3:50 pm

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.

User avatar
sirhc
Employee
Employee
 
Posts: 7415
Joined: Tue Apr 08, 2014 3:48 pm
Location: Lancaster, PA
Has thanked: 1608 times
Been thanked: 1325 times

Re: PoE on/off from cmdline

Thu Nov 17, 2016 4:20 pm

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?
Support is handled on the Forums not in Emails and PMs.
Before you ask a question use the Search function to see it has been answered before.
To do an Advanced Search click the magnifying glass in the Search Box.
To upload pictures click the Upload attachment link below the BLUE SUBMIT BUTTON.

User avatar
mike99
Associate
Associate
 
Posts: 837
Joined: Tue Nov 25, 2014 10:53 am
Location: Quebec, Canada
Has thanked: 95 times
Been thanked: 245 times

Re: PoE on/off from cmdline

Thu Nov 17, 2016 6:56 pm

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.

User avatar
jakematic
Experienced Member
 
Posts: 168
Joined: Thu Jul 14, 2016 8:15 am
Location: NC USA
Has thanked: 362 times
Been thanked: 87 times

Re: PoE on/off from cmdline

Fri Nov 18, 2016 9:07 am

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.

User avatar
Eric Stern
Employee
Employee
 
Posts: 532
Joined: Wed Apr 09, 2014 9:41 pm
Location: Toronto, Ontario
Has thanked: 0 time
Been thanked: 130 times

Re: PoE on/off from cmdline

Fri Nov 18, 2016 10:52 am

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)

User avatar
jakematic
Experienced Member
 
Posts: 168
Joined: Thu Jul 14, 2016 8:15 am
Location: NC USA
Has thanked: 362 times
Been thanked: 87 times

Re: PoE on/off from cmdline

Fri Nov 18, 2016 2:06 pm

Well.... sed ain't gonna work on that file! :shock:

User avatar
sirhc
Employee
Employee
 
Posts: 7415
Joined: Tue Apr 08, 2014 3:48 pm
Location: Lancaster, PA
Has thanked: 1608 times
Been thanked: 1325 times

Re: PoE on/off from cmdline

Fri Nov 18, 2016 2:26 pm

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:
Support is handled on the Forums not in Emails and PMs.
Before you ask a question use the Search function to see it has been answered before.
To do an Advanced Search click the magnifying glass in the Search Box.
To upload pictures click the Upload attachment link below the BLUE SUBMIT BUTTON.

Next
Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests