APC Power Distribution Unit (PDU) Plugin Added

Posted on
Thu Feb 05, 2015 7:39 am
anyone offline
Posts: 23
Joined: Apr 03, 2011
Location: Norfolk, VA

APC Power Distribution Unit (PDU) Plugin Added

APC has several models of Ethernet enabled Power Distribution Units (PDU). These devices have power outlets that can be remotely switched On or Off from a web interface or SNMP commands.

This Indigo plugin controls the On/Off function of outlets on APC's MasterSwitch PDUs

This plugin should work with any APC MasterSwitch device. It does not currently work with MasterSwitch VM or MasterSwitch Plus Units.

It was developed with the following equipment:
APC MasterSwitch AP9211
APC AP9606 Web/SNMP Management SmartSlot Card


Supported Operations
Turn On
Turn Off
Toggle
Status Request

The plugin can be downloaded here: http://www.indigodomo.com/library/358/

Posted on
Sun Sep 10, 2017 9:22 am
Swancoat offline
Posts: 399
Joined: Nov 20, 2009
Location: Houston

Re: APC Power Distribution Unit (PDU) Plugin Added

So I found one of these units on eBay for $20 and it works great.

I am having a lot of trouble getting this plugin running though - specifically the snmptrapd process. I'm not really sure where to put the file miss file. Even when I show hidden files, I am not allowed access to the required directory.

I know this post is over 2 years old, but hoping you're still current with it and have some ideas.

http://nerdhome.jimdo.com

Posted on
Sun Sep 10, 2017 10:05 am
anyone offline
Posts: 23
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: APC Power Distribution Unit (PDU) Plugin Added

I'm still around and will definitely try to help you get the plugin going.

A couple of questions. What version of OS X are you running and moving which file is causing you some challenges? Your response said; "file miss file"

Is the trouble with moving the "PowerNet-MIB.txt" file to the "MIBS" directory or something else?

Posted on
Sun Sep 10, 2017 1:37 pm
Swancoat offline
Posts: 399
Joined: Nov 20, 2009
Location: Houston

Re: APC Power Distribution Unit (PDU) Plugin Added

Ugh - I guess I should proofread my own posts.

Yeah, it's the PowerNet - MIB.txt file. I did figure out it's a hidden directory, but even when I show the hidden files I can't copy into that one.

I'm running OS X 10.11.6.

Thanks!

http://nerdhome.jimdo.com

Posted on
Sun Sep 10, 2017 5:53 pm
anyone offline
Posts: 23
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: APC Power Distribution Unit (PDU) Plugin Added

No problem, I figured that’s what you meant.

Finder should allow you to move the file to the MIBs folder, but it will request that you enter your OS X password to confirm that’s what you want to do.

    Open a Finder window
    Click “Go” on the Menu Bar
    Select “Go to Folder…”
    Paste or type in: “/usr/share/snmp/mibs”
That should open the MIBS folder.

In another Finder window navigate to wherever the PowerNet-MIB.txt file is located.

From this point, you can click, drag and drop the file from one Finder window to the other.

When you do this, you will see a Dialog Box requesting that you "Authenticate". I attached an image of that message. It's just ensuring you want to move the file to that directory.

    On the Dialog Box Click “Authenticate”
    Enter in your OS X Username (if it is not shown)
    Enter in your OS X password
    Click "OK"

It’s moved.

If you have trouble moving the file with the Finder, you can alternatively move the file with the terminal. The command is:

    sudo mv PowerNet-MIB.txt /usr/share/snmp/mibs

Again, it's going to ask for a password, that's your OS X password.

Let me know if this does or does not work for you, as well as if you need any other help.
Attachments
mibs_dialog_box.png
mibs_dialog_box.png (48.33 KiB) Viewed 693 times

Posted on
Mon Sep 11, 2017 5:57 pm
Swancoat offline
Posts: 399
Joined: Nov 20, 2009
Location: Houston

Re: APC Power Distribution Unit (PDU) Plugin Added

The finder method is what I was trying, and it doesn't even ask for authentication. It just shows the symbol for 'not allowed' (circle with diagonal line through it) when you drag over that directory.

Attempting in the terminal gives me this:
Code: Select all
mv: rename PowerNet-MIB.txt to /usr/share/snmp/mibs/PowerNet-MIB.txt: Operation not permitted
Tivoli-Office:Desktop jswancoat$


I am using an Administrator account, so don't know what the deal is.

http://nerdhome.jimdo.com

Posted on
Mon Sep 11, 2017 7:14 pm
anyone offline
Posts: 23
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: APC Power Distribution Unit (PDU) Plugin Added

I was able to duplicate your issue on a MacBook Pro I have running 10.11.6

The issue appears to be related to System Integrity Protection (SIP). Take a look at this link for an explanation of what it does and how to disable it, temporarily.

http://osxdaily.com/2015/10/05/disable- ... -mac-os-x/

What’s surprising, is I couldn’t duplicate the issue on 10.12.x.

The protection system didn’t exist when I wrote the plugin and my test environment was 10.6.x and 10.7.x. The fact that it is now required, is a strong reason that I really need to revisit this plugin in order to see if I can avoid the reliance on the MIB file.

Until I can do that, if you’re willing, just temporarily disable SIP, try to move the file then re-enable it. That should get you closer to implementing the plugin.

Posted on
Tue Sep 12, 2017 6:54 pm
Swancoat offline
Posts: 399
Joined: Nov 20, 2009
Location: Houston

Re: APC Power Distribution Unit (PDU) Plugin Added

I'm a lot closer, but it the snmptrapd process still doesn't start.

I DID get the PowerNet_MIB file loaded to the correct directory.

However, the snmptrapd process still doesn't start. The plugin does communicate with the PDU though, and I can turn the outlets on and off. I've also used the troubleshooting steps in the READ ME which include terminal commands to get the outlet status and turn an outlet on and they both work with the correct output being displayed (and the outlet actually turning on).
Code: Select all
ivoli-Office:~ jswancoat$ snmpwalk -v 1 -c public 10.0.1.120 PowerNet-MIB::sPDUOutletCtl
PowerNet-MIB::sPDUOutletCtl.1 = INTEGER: outletOn(1)
PowerNet-MIB::sPDUOutletCtl.2 = INTEGER: outletOn(1)
PowerNet-MIB::sPDUOutletCtl.3 = INTEGER: outletOn(1)
PowerNet-MIB::sPDUOutletCtl.4 = INTEGER: outletOn(1)
PowerNet-MIB::sPDUOutletCtl.5 = INTEGER: outletOn(1)
PowerNet-MIB::sPDUOutletCtl.6 = INTEGER: outletOn(1)
PowerNet-MIB::sPDUOutletCtl.7 = INTEGER: outletOn(1)
PowerNet-MIB::sPDUOutletCtl.8 = INTEGER: outletOn(1)
Tivoli-Office:~ jswancoat$ snmpset -m PowerNet-MIB -v 1 -c private -v 1 10.0.1.120 sPDUOutletCtl.1 i 1
PowerNet-MIB::sPDUOutletCtl.1 = INTEGER: outletOn(1)


It just seems like the snmptrapd process will not start for whatever reason. The only thing I can think of is an error in the sudoers file? The last lines of it currently look like this:
Code: Select all
## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /private/etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /private/etc/sudoers.d
jswancoat ALL= NOPASSWD: /bin/kill
jswancoat ALL= NOPASSWD: /usr/sbin/snmptrapd

http://nerdhome.jimdo.com

Posted on
Wed Sep 13, 2017 4:18 pm
anyone offline
Posts: 23
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: APC Power Distribution Unit (PDU) Plugin Added

That definitely looks like progress. :)

What version of Indigo are you running?

If you're running, Indigo 7.x, download the plugin again which I updated from 0.5 to 0.6. I made a quick change which should allow the plugin to correctly call "snmptrapd", under Indigo 7.x

Use the link from the beginning of the thread which was http://www.indigodomo.com/library/358/

If you're not running Indigo 7.x, don't install version 0.6 of the plugin yet. Just let me know which version you're running so I can think about additional troubleshooting steps.

Posted on
Thu Sep 14, 2017 4:34 pm
Swancoat offline
Posts: 399
Joined: Nov 20, 2009
Location: Houston

Re: APC Power Distribution Unit (PDU) Plugin Added

Thanks for the update!

I'm on Indigo 7.0.3.

I just added the update and snmptrapd still fails to start. I'm not sure it's such a big deal though... Indigo can control the PDU outlets on and off just fine and I don't think I'll actually be controlling the PDU from the web interface all that often.

As tricky as this snmp thing is, it's still easier than getting the PDU initially set up (mainly the most difficult password reset process in the history of passwords).

I was satisfied with it enough that I've pressed it into service in place of my old PDU anyway.

http://nerdhome.jimdo.com

Posted on
Thu Sep 14, 2017 7:15 pm
anyone offline
Posts: 23
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: APC Power Distribution Unit (PDU) Plugin Added

I agree with you on how challenging it is to reset the password, for one of my PDU's this site was extremely helpful http://www.forked.net/forums/viewtopic.php?f=13&t=3490 I found that the hoops you end up jumping thru really depend on what firmware is loaded and don't get easier with practice, for me reseting a 2nd PDU a couple years later was just a challenging as the 1st.

Let's try a couple of more things. We need to figure out if you can manual launch snmptrapd, the new version of the plugin 'should' be launching it correctly.

To do that manually, paste the following command into terminal:

Code: Select all
sudo /usr/sbin/snmptrapd -m PowerNet-MIB -c '/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/APC PDU Control.indigoPlugin/Contents/Server Plugin/snmptrapd.conf'

Ultimately, this is what the plugin is attempting to do.

It should *not* require a password if the entries in the '/etc/sudoers' file are working.

If that seems to work, you can confirm the snmptrap process is actually running with the following command:

Code: Select all
ps -U root | grep snmptrap

It should provide a result similiar to this.

37794 ?? 0:00.02 /usr/sbin/snmptrapd -m PowerNet-MIB -c /Library/Application Support/Perceptive Automation/Indigo 7/Plugins/APC PDU Control.indigoPlugin/Contents/Server Plugin/snmptrapd.conf


The process ID, is the very first number.

To manuallly kill snmptrapd, use the following command:

Code: Select all
sudo /bin/kill -TERM 37794

replace 37794, the Process ID, with whatever number is displayed on your end.

Let me know what output you get when attempting this in terminal.

*Edited to insert proper formatting*

Posted on
Sat Sep 16, 2017 9:20 am
Swancoat offline
Posts: 399
Joined: Nov 20, 2009
Location: Houston

Re: APC Power Distribution Unit (PDU) Plugin Added

Hmmm, neither of those commands seem to really do anything...

Code: Select all
Tivoli-Office:~ jswancoat$ sudo /usr/sbin/snmptrapd -m PowerNet-MIB -c '/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/APC PDU Control.indigoPlugin/Contents/Server Plugin/snmptrapd.conf'
Tivoli-Office:~ jswancoat$ ps -U root | grep snmptrap
Tivoli-Office:~ jswancoat$


I don't see anything in the activity monitor either (not sure I would though).

http://nerdhome.jimdo.com

Posted on
Sat Sep 16, 2017 10:21 pm
anyone offline
Posts: 23
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: APC Power Distribution Unit (PDU) Plugin Added

Try this version, 0.6b which you can download at this link https://www.dropbox.com/s/57kg046f6j9wi4e/APC%20PDU%20Control.zip?dl=0

I was able to successfully test this version on a configuration fairly close to yours, Indigo 7.0.4 on OS X 10.11.6. I'm pretty confident this will work for you as well.

Posted on
Sun Sep 17, 2017 4:25 pm
Swancoat offline
Posts: 399
Joined: Nov 20, 2009
Location: Houston

Re: APC Power Distribution Unit (PDU) Plugin Added

:D
Code: Select all
Sep 17, 2017, 5:23:44 PM
   Stopping plugin APC PDU Control (pid 52823)
   Stopped plugin APC PDU Control
   Downgrading plugin APC PDU Control to older version 0.61b (previous version moved to trash)
   Loading plugin "APC PDU Control 0.61b"
   Starting plugin "APC PDU Control 0.61b" (pid 48039)
   Started plugin "APC PDU Control 0.61b"
   APC PDU Control                 snmptrapd was successfully started.


Thanks!

http://nerdhome.jimdo.com

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest