Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

We Value Your Feedback!
Could you please spare a few minutes to share your thoughts on Cloud Connected vs On-Premise Services. Your feedback can help us shape the future of services.
Learn more about the survey or Click here to Launch the survey
Schneider Electric Services Innovation Team!

getting PDU configuration from the linux command line

APC UPS Data Center & Enterprise Solutions Forum

Schneider, APC support forum to share knowledge about installation and configuration for Data Center and Business Power UPSs, Accessories, Software, Services.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results forย 
Showย ย onlyย  | Search instead forย 
Did you mean:ย 
  • Home
  • Schneider Electric Community
  • APC UPS, Critical Power, Cooling and Racks
  • APC UPS Data Center & Enterprise Solutions Forum
  • getting PDU configuration from the linux command line
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
BillP
Administrator BillP Administrator
5060
voidstar_apc
Janeway voidstar_apc
196
Erasmus_apc
Sisko Erasmus_apc
112
Teken
Spock Teken
111
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to APC UPS Data Center & Enterprise Solutions Forum
Solved
Anonymous user
Not applicable

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

0 Likes
5
2975
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

getting PDU configuration from the linux command line

I'd like to be able to grab the pages from the PDU webserver via the command line, say using wget. I have succeeded in downloading config.ini over ftp with wget, but have had no joy with the olgroups.htm page. Can you help, please?

Below is a snip of my attempt. I've replaced the host and IP to protect the innocent, and limited tries to 1, since the default is 20 and they all fail ๐Ÿ˜ž
"
wget --debug -t 1 -x --no-check-certificate [https://pdu-host/olgroups.htm]
Setting --tries (tries) to 1
Setting --force-directories (dirstruct) to 1
Setting --check-certificate (checkcertificate) to 0
DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.

--09:12:15-- [https://pdu-host/olgroups.htm]
Resolving pdu-host... w.x.y.z
Caching pdu-host => w.x.y.z
Connecting to pri-pdu-1|w.x.y.z|:443... connected.
Created socket 3.
Releasing 0x085e67a0 (new refcount 1).
Initiating SSL handshake.
Handshake successful; connected socket 3 to SSL handle 0x085e6ba8
certificate:
WARNING: Certificate verification error for pri-pdu-1: unable to get local issuer certificate
WARNING: certificate common name `ZA0621015694' doesn't match requested host name `pri-pdu-1'.

---request begin---
GET /olgroups.htm HTTP/1.0
User-Agent: Wget/1.10.2 (Red Hat modified)
Accept: */*
Authorization: Basic YXBjOmlOME9wWWli
Host: pri-pdu-1
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response... No data received.
Closed 3/SSL 0x85e6ba8
Giving up.
"

Thanks in advance

Labels
  • Labels:
  • Racks, Rack Accessories, & Cooling
Reply

Link copied. Please paste this link to share this article on your social media post.

  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
voidstar_apc
Janeway voidstar_apc
Janeway

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

0 Likes
0
2976
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

Alright, I've used both curl and wget to grab web pages off of an NMC running AOS 3.5.7. Here are commands I used under Cygwin for four different configurations: curl with http, curl with https, wget with http, and wget with https. I've broken up long lines with the line continuation character '\' which should work in your shell.

1. curl with http:

curl -b apccookie -c apccookie -k http://NMC_IP/logon.htm > /dev/null
curl -b apccookie -c apccookie -k http://NMC_IP/Forms/login1 \
-d login_username=apc -d login_password=apc > /dev/null
curl -b apccookie -c apccookie -k http://NMC_IP/home.htm
curl -b apccookie -c apccookie -k http://NMC_IP/logout.htm > /dev/null
2. curl with https:
curl -b apccookie -c apccookie -k https://NMC_IP/logon.htm > /dev/null
curl -b apccookie -c apccookie -k https://NMC_IP/Forms/login1 \
-d login_username=apc -d login_password=apc > /dev/null
curl -b apccookie -c apccookie -k https://NMC_IP/home.htm
curl -b apccookie -c apccookie -k https://NMC_IP/logout.htm > /dev/null
3. wget with http:
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
http://NMC_IP/logon.htm -o /dev/null
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
http://NMC_IP/Forms/login1 -o /dev/null \
--post-data 'login_username=apc&login_password=apc'
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
http://NMC_IP/home.htm
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
http://NMC_IP/logout.htm -o /dev/null
4. wget with https:
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
--no-check-certificate -t 1 https://NMC_IP/logon.htm -o /dev/null
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
--no-check-certificate -t 1 https://NMC_IP/Forms/login1 -o /dev/null \
--post-data 'login_username=apc&login_password=apc'
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
--no-check-certificate -t 1 https://NMC_IP/home.htm
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
--no-check-certificate -t 1 https://NMC_IP/logout.htm -o /dev/null
Using wget with https did have one issue: it would successfully complete the https GET or POST, but aftewards it would display an error: "Read error at byte 2872 (error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac).Giving up." Then it would retry over and over again. Since it was actually successful, I bypassed the problem by setting the number of retries to 1 (-t 1).

Also note: in a production environment, the command line options disabling certificate checking should be replaced with options to trust a saved copy of the certificate.

Finally, I highly recommend using SNMP instead. Hopefully the SNMP tools like snmpget are already installed on your linux machine.

I hope this helps.

See Answer In Context

Reply

Link copied. Please paste this link to share this article on your social media post.

Replies 5
BillP
Administrator BillP Administrator
Administrator

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

0 Likes
0
2976
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

i personally have no experience with this but I will see if Cap1 (another user here) has any insight for you.

Reply

Link copied. Please paste this link to share this article on your social media post.

BillP
Administrator BillP Administrator
Administrator

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

0 Likes
0
2976
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

Do you specifically need the web output?

Or are you just interested in the data that is contained within the web pages?

I can't help you with using wget to grab the web pages, however if you're just out to get the data from your PDU I would recommend utilizing SNMP to get the data you're looking for. If you use a MIB browser to view an APC PDU you'll see all the data you might want. At that point you can pick and choose which OIDs to poll and record through a script.

If you go to http://www.apcc.com/tools/download/ and select firmware upgrades - all in the first dropdown box you can find a current version of our MIB.

Reply

Link copied. Please paste this link to share this article on your social media post.

Anonymous user
Not applicable

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

0 Likes
0
2976
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

Many thanks to "i picKed a winna" and " APCbean".

I'm not overly fussed that I get the web page - it is the content that I seek, but the work environment is somewhat paranoid regarding security, and deploying additional software, such as the MIB browser will take much paperwork and many levels of sign-off before being finally disallowed, no doubt.

So, just to summarize my requirement, I want a command-line that I can run from Linux (Red Hat EL AS r4.5) to write content from the PDUs to text files that I can parse with awk/perl, etc. Just now I want the content from the olgroups.htm page, but its likely that I'll want other pages in future.

Any ideas?
Thanks in advance.

Reply

Link copied. Please paste this link to share this article on your social media post.

voidstar_apc
Janeway voidstar_apc
Janeway

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

0 Likes
0
2976
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

If you're using Red Hat Linux, you probably already have the Net-SNMP suite of command line utilities. For instance, try using snmpget.

As for the wget log you posted, I hope you or one of the administrators will scrub your password out of the log. And speaking of password, while I'm not familiar with the PDU firmware you're using, I assume it's a 3.x.x one. Unlike the 2.x.x firmwares, the 3.x.x ones use a custom password page and a cookie rather than HTTP Basic Auth. Logging into the card via the web therefore requires doing a POST against the login page to get the cookie, and then using that to retrieve your desired page.

I'm not sure if that explains the results you're getting. On Monday I will have to try using wget to log into an NMC set up for https.

Reply

Link copied. Please paste this link to share this article on your social media post.

voidstar_apc
Janeway voidstar_apc
Janeway

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

0 Likes
0
2977
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2021-06-28 03:18 AM . Last Modified: โ€Ž2024-03-18 04:45 AM

Alright, I've used both curl and wget to grab web pages off of an NMC running AOS 3.5.7. Here are commands I used under Cygwin for four different configurations: curl with http, curl with https, wget with http, and wget with https. I've broken up long lines with the line continuation character '\' which should work in your shell.

1. curl with http:

curl -b apccookie -c apccookie -k http://NMC_IP/logon.htm > /dev/null
curl -b apccookie -c apccookie -k http://NMC_IP/Forms/login1 \
-d login_username=apc -d login_password=apc > /dev/null
curl -b apccookie -c apccookie -k http://NMC_IP/home.htm
curl -b apccookie -c apccookie -k http://NMC_IP/logout.htm > /dev/null
2. curl with https:
curl -b apccookie -c apccookie -k https://NMC_IP/logon.htm > /dev/null
curl -b apccookie -c apccookie -k https://NMC_IP/Forms/login1 \
-d login_username=apc -d login_password=apc > /dev/null
curl -b apccookie -c apccookie -k https://NMC_IP/home.htm
curl -b apccookie -c apccookie -k https://NMC_IP/logout.htm > /dev/null
3. wget with http:
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
http://NMC_IP/logon.htm -o /dev/null
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
http://NMC_IP/Forms/login1 -o /dev/null \
--post-data 'login_username=apc&login_password=apc'
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
http://NMC_IP/home.htm
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
http://NMC_IP/logout.htm -o /dev/null
4. wget with https:
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
--no-check-certificate -t 1 https://NMC_IP/logon.htm -o /dev/null
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
--no-check-certificate -t 1 https://NMC_IP/Forms/login1 -o /dev/null \
--post-data 'login_username=apc&login_password=apc'
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
--no-check-certificate -t 1 https://NMC_IP/home.htm
wget --load-cookies apccookie --save-cookies apccookie --keep-session-cookies \
--no-check-certificate -t 1 https://NMC_IP/logout.htm -o /dev/null
Using wget with https did have one issue: it would successfully complete the https GET or POST, but aftewards it would display an error: "Read error at byte 2872 (error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac).Giving up." Then it would retry over and over again. Since it was actually successful, I bypassed the problem by setting the number of retries to 1 (-t 1).

Also note: in a production environment, the command line options disabling certificate checking should be replaced with options to trust a saved copy of the certificate.

Finally, I highly recommend using SNMP instead. Hopefully the SNMP tools like snmpget are already installed on your linux machine.

I hope this helps.

Reply

Link copied. Please paste this link to share this article on your social media post.

Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

ย 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings ยฉ 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of