- Community Home
- >
- Servers and Operating Systems
- >
- HPE ProLiant
- >
- ProLiant Servers (ML,DL,SL)
- >
- Create new SNMP v3 user via Redfish API
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 03:17 AM - last edited on 11-23-2022 05:24 AM by support_s
11-23-2022 03:17 AM - last edited on 11-23-2022 05:24 AM by support_s
I'm trying to figure out how to create a new SNMP v3 user on our iLO interfaces via the redfish API. The github redfish reference does not seem to provide an example of how to do this. I think this is what I need to do is :
function nextID() {
IDs=$(curl --silent --insecure --header "X-Auth-Token: ${iLOAuth}" --request GET ${iLOSSO}/redfish/v1/Managers/1/snmpservice/snmpusers | jq -r '.Members[]' | grep 'odata.id' | tr -d '"' | cut -d/ -f8)
for i in {1..8}; do
if [[ ${IDs} =~ "${i}" ]]; then
echo "${i} is in use"
else
j=${i}
break
fi
done
}
SECNAME='newname'
AuthTp='SHA'
PrivTp='AES'
AuthP='thissecuritypassphrase'
PrivP='someothersecuritypassphrase'
DATA='{"SecurityName":"'${SECNAME}'","AuthProtocol":"'${AuthTp}'","AuthPassphrase":"'${AuthP}'","PrivacyProtocol":"'${PrivP}'","PrivacyPassphrase":"'${PrivP}'","UserEngineID":null}'
SERVER=myserver.com
# HARDW is set to a file of all extracted hardware from OneView
UUID=$(jq -r '.members[] | select(.serverName=="'${SERVER}'") | "\(.uuid)"' ${HARDW})
read iLOSSO iLOAuth <<< $(curl --silent --insecure --header "X-API-Version: ${currentVersion}" --header "auth: ${sessionID}" --request GET ${OneView}/rest/server-hardware/${UUID}/remoteConsoleUrl | jq -r '.remoteConsoleUrl' | sed -e 's|hplocons|https|' -e 's|addr=||' -e 's|^\(.*\)&sessionkey=\(.*\)$|\1 \2|')
nextID
curl --silent --insecure --header "X-API-Token: ${iLOAuth}" --header "content-type: application/json" --data "${DATA}" --request PATCH ${iLOSSO}/redfish/v1/Managers/v1/snmpservice/snmpusers/${j}
but that gives back:
{
"error": {
"code": "iLO.0.10.ExtendedInfo",
"message": "See @Message.ExtendedInfo for more information.",
"@Message.ExtendedInfo": [
{
"MessageArgs": [
"Invalid URI"
],
}
]
}
}
So, not quite correct. Does anyone know the correct syntax/method to create a new SNMP v3 user?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 04:18 AM
11-23-2022 04:18 AM
Query: Create new SNMP v3 user via Redfish API
System recommended content:
2. HPE iLO 5 2.72 User Guide | iLO RESTful API
Please click on "Thumbs Up/Kudo" icon to give a "Kudo".
Thank you for being a HPE valuable community member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 05:21 AM
11-23-2022 05:21 AM
SolutionI got it to work:
SECNAME='newname'
AuthTp='SHA'
PrivTp='AES'
AuthP='thissecuritypassphrase'
PrivP='someothersecuritypassphrase'
DATA='{"SecurityName":"'${SECNAME}'","AuthProtocol":"'${AuthTp}'","AuthPassphrase":"'${AuthP}'","PrivacyProtocol":"'${PrivP}'","PrivacyPassphrase":"'${PrivP}'"}'
SERVER=myserver.com
# HARDW is set to a file of all extracted hardware from OneView
UUID=$(jq -r '.members[] | select(.serverName=="'${SERVER}'") | "\(.uuid)"' ${HARDW})
read iLOSSO iLOAuth <<< $(curl --silent --insecure --header "X-API-Version: ${currentVersion}" --header "auth: ${sessionID}" --request GET ${OneView}/rest/server-hardware/${UUID}/remoteConsoleUrl | jq -r '.remoteConsoleUrl' | sed -e 's|hplocons|https|' -e 's|addr=||' -e 's|^\(.*\)&sessionkey=\(.*\)$|\1 \2|')
curl --silent --insecure --header "X-API-Token: ${iLOAuth}" --header "content-type: application/json" --data "${DATA}" --request POST ${iLOSSO}/redfish/v1/Managers/v1/SnmpService/SNMPUsers/ | jq -r '.'
If you want to do a group of servers, can put from UUID= on down in a for SERVER in ... loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 08:15 PM
11-23-2022 08:15 PM
Re: Query: Create new SNMP v3 user via Redfish API
Hello @BradV,
That's great! We are glad to know you were able to find the solution and we appreciate you for keeping us updated.
Thanks,
Sunitha G
I'm an HPE employee.
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
