pr8kerl / f5er Goto Github PK
View Code? Open in Web Editor NEWAn F5/Big-IP REST client
License: Other
An F5/Big-IP REST client
License: Other
Got the following error when trying to log in:
{
"Url": "https://[redacted]/mgmt/shared/authn/login",
"Method": "POST",
"Params": {},
"Payload": {
"loginProviderName": "tmos",
"password": "[redacted]",
"username": "[redacted]"
},
"RawPayload": false,
"Result": {
"token": {
"token": "",
"expirationMicros": 0
}
},
"CaptureResponseBody": false,
"ResponseBody": null,
"Error": {
"Message": "loginProviderName is invalid.",
"Errors": null
},
"Userinfo": null,
"Header": null,
"Transport": null
}
2017/07/17 15:05:07 --------------------------------------------------------------------------------
2017/07/17 15:05:07 REQUEST
2017/07/17 15:05:07 --------------------------------------------------------------------------------
2017/07/17 15:05:07 Method: GET
2017/07/17 15:05:07 URL: https://[redacted]/mgmt/tm/ltm/virtual
2017/07/17 15:05:07 Header: map[X-F5-Auth-Token:[] Accept:[application/json]]
2017/07/17 15:05:07 Form: map[]
2017/07/17 15:05:07 Payload:
2017/07/17 15:05:07 null
2017/07/17 15:05:07 --------------------------------------------------------------------------------
2017/07/17 15:05:07 RESPONSE
2017/07/17 15:05:07 --------------------------------------------------------------------------------
2017/07/17 15:05:07 Status: 401
2017/07/17 15:05:07 Header:
2017/07/17 15:05:07 {
"Cache-Control": [
"no-store, no-cache, must-revalidate"
],
"Content-Length": [
"1515"
],
"Content-Security-Policy": [
"default-src 'self' 'unsafe-inline' 'unsafe-eval'"
],
"Content-Type": [
"application/json"
],
"Date": [
"17 Jul 2017 19:04:55 UTC"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"Server": [
"com.f5.rest.common.RestRequestSender"
],
"Strict-Transport-Security": [
"max-age=16070400; includeSubDomains"
],
"X-Content-Type-Options": [
"nosniff"
],
"X-Frame-Options": [
"SAMEORIGIN"
],
"X-Xss-Protection": [
"1; mode=block"
]
}
2017/07/17 15:05:07 Body:
2017/07/17 15:05:07 {
"code": 401,
"message": "X-F5-Auth-Token does not exist.",
"referer": "[redacted]",
"restOperationId": 18365773,
"errorStack": [
"java.lang.SecurityException: X-F5-Auth-Token does not exist.",
"at com.f5.rest.workers.ForwarderWorker.failPermissionValidation(ForwarderWorker.java:686)",
"at com.f5.rest.workers.ForwarderWorker.evaluatePermission(ForwarderWorker.java:629)",
"at com.f5.rest.workers.ForwarderPassThroughWorker.onForward(ForwarderPassThroughWorker.java:211)",
"at com.f5.rest.workers.ForwarderPassThroughWorker.onGet(ForwarderPassThroughWorker.java:418)",
"at com.f5.rest.common.RestWorker.callDerivedRestMethod(RestWorker.java:1042)",
"at com.f5.rest.common.RestWorker.callRestMethodHandler(RestWorker.java:1009)",
"at com.f5.rest.common.RestServer.processQueuedRequests(RestServer.java:1002)",
"at com.f5.rest.common.RestServer.access$000(RestServer.java:45)",
"at com.f5.rest.common.RestServer$1.run(RestServer.java:248)",
"at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)",
"at java.util.concurrent.FutureTask.run(FutureTask.java:262)",
"at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)",
"at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)",
"at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)",
"at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)",
"at java.lang.Thread.run(Thread.java:744)\n"
]
}
{
"Status": 401,
"Message": "X-F5-Auth-Token does not exist."
}
2017/07/17 15:05:07 error: 401 Unauthorised - check your username and passwd
@cgunning kindly pointed out that on an F5 with BIG-IP v12.0, the field LBNodeFQDN.Interval is a string instead of an int. BIG-IP version 11 uses an int for this field which feels correct. Suspect a bug with BIG-IP version 12.
Despite setting the correct environment variables as per the README, f5er will throw an error unless a config file is present.
ryandraga@kusanagi ~/Revisions/f5er (master) $ export F5_USERNAME="[redacted]"
ryandraga@kusanagi ~/Revisions/f5er (master) $ export F5_PASSWD="[redacted]"
ryandraga@kusanagi ~/Revisions/f5er (master) $ ./f5er
error: no config file found: Config File "f5" Not Found in "[/Users/ryandraga/.f5 /Users/ryandraga/Revisions/f5er]"```
Should it not be "make deps" instead of "make update" ?
I would like to get current connections for all pool members. I read the code and don't find any method to get it in one request. So, currently, I must iterate on all pools and get statistics on each.
But with the F5 API, you can get all statistics pool members in one request. You can call this url : /mgmt/tm/ltm/pool/members/stats
This endpoint returns a similar result at /mgmt/tm/ltm/pool/stats
but adds some entries that contains member statistics : https://localhost/mgmt/tm/ltm/pool/members/~Common~POOL_NAME/members/stats
When an iRule contains "&", "<" or ">" it will be escaped by json.Marshal before POST/PUT to the bigip, this makes the request fail due to that the TCL code can't be parsed.
Hi Ian,
I would like to use some of your code--specifically, the request and response structs--in a derivative project that I'm working on. Per your license, this is okay if I keep your copyright intact and maintain a free license. Are you okay with this if my project is licensed under the MIT license?
I plan on implementing the REST calls myself but copying your structs would save a massive amount of time. Thanks for producing f5er!
Chris
It doesn't look like the output from f5er is going to stdout. I'm trying to parse the output with jq and it won't work unless I redirect stderr to stdout
$ ./f5er -d show device | jq '.Items[] | select(.failoverState == "active") .managementIP'
{
"selfLink": "https://localhost/mgmt/tm/cm/device?ver=12.0.0",
"Items": [
{
"name": "Unit1",
"fullPath": "/Common/Unit1",
"failoverState": "active",
"managementIP": "192.168.1.11"
},
{
"name": "Unit2",
"fullPath": "/Common/Unit2",
"failoverState": "standby",
"managementIP": "192.168.1.12"
}
]
}
$ ./f5er -d show device 2>&1 | jq -r '.Items[] | select(.failoverState == "active") .managementIP'
192.168.1.11
Sometimes we may need access the F5 through some proxies, shall we support the system proxy from environment variables?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.