Closed crockk closed 2 years ago
Hello, Fixed the file, as, by default, we are using now v2.0 of InfluxDB. The response you are getting from the script is Connection close, I have never seen that, can the server from where you are running the script connect to the Enterprise Manager? Meaning the TCP port for the API is open, etc?
A simple way to check this is by taking any of the queries, imagine the login one, and running it directly on the console: veeamUsername="YOUREMUSER" #Your username, if using domain based account, please add it like user@domain.com (if you use domain\account it is not going to work!) veeamPassword='YOUREMPASSWORD' veeamJobSessions="100" veeamAuth=$(echo -ne "$veeamUsername:$veeamPassword" | base64); curl -X POST "https://YOURVEEAMEMIP:YOURPORT/api/sessionMngr/?v=latest" -H "Authorization:Basic $veeamAuth" -H "Content-Length: 0" -H "Accept: application/json" -k --silent | awk 'NR==1{sub(/^\xef\xbb\xbf/,"")}1'
Try that and let us know, directly on the Linux console. thanks!
After speaking to my superior and using the test script you suggested, I discovered that I was not using the FQDN of our domain. After switching to the FQDN it seems to be working, other than some (likely unrelated) permissions issues with InfluxDB V2. Thanks for the nudge in the right direction!
Amazing, I am pretty sure it will look amazing on your screens guys. I guess you can not share a screenshot, but if possible, always happy to see it out in the wild, cheers.
When we get it working, I will be sure to!
I am still having trouble authenticating with InfluxDB though. I switched from username/password authentication to API Token based authorization, and I've been referring to the API documentation to try and get it to work, however it seems no matter what I try I am getting 401 unauthorized. I am sure that my API token is scoped correctly. I am passing in the organization ID under the org
query param as per the docs, as well as the bucket ID in the bucket
param.
This is not directly related to Veeam so I'm not sure if you could assist, but if you had any ideas it would be appreciated. We can move the discussion to a more private channel if you prefer.
Here is my edited curl from your script:
curl -i -X POST "$veeamInfluxDBURL:$veeamInfluxDBPort/api/v2/write?bucket=$veeamInfluxDB&org=$veeamInfluxDBOrg&precision=s" \
-H 'Content-type: text/plain; charset=utf-8' \
-H 'Authorization: Token $veeamInfluxDBToken' \
-H 'Accept: application/json' \
--data-binary "veeam_em_overview,host=$veeamRestServer veeamBackupServers=$veeamBackupServers,veeamProxyServers=$veeamProxyServers,veeamRepositoryServers=$veeamRepositoryServers,veeamRunningJobs=$veeamRunningJobs,veeamScheduledJobs=$veeamScheduledJobs,veeamSuccessfulVmLastestStates=$veeamSuccessfulVmLastestStates,veeamWarningVmLastestStates=$veeamWarningVmLastestStates,veeamFailedVmLastestStates=$veeamFailedVmLastestStates"
Which results in:
Writing veeam_em_overview to InfluxDB
HTTP/1.1 401 Unauthorized
Content-Type: application/json; charset=utf-8
X-Influxdb-Build: OSS
X-Influxdb-Version: 2.1.1
X-Platform-Error-Code: unauthorized
Date: Fri, 04 Feb 2022 21:38:59 GMT
Content-Length: 55
{"code":"unauthorized","message":"unauthorized access"}
I am also seeing this in the InfluxDB logs, as if my authorization is not being sent properly? But as far as I can tell, it is:
Feb 04 21:19:12 influxdb1 influxd-systemd-start.sh[164020]: ts=2022-02-04T21:19:12.128668Z lvl=info msg=Unauthorized log_id=0ZPxQVIW000 error="authorization not found"
I can share InfluxDB details if needed.
Hello, You should not use Org ID, but Org Name, make sure the uppercase and all are identical, same for bucket.
Should work without much issue
On Fri, 4 Feb 2022, 21:41 Nolan Crooks, @.***> wrote:
When we get it working, I will be sure to!
I am still having trouble authenticating with InfluxDB though. I switched from username/password authentication to API Token based authorization, and I've been referring to the API documentation https://docs.influxdata.com/influxdb/v2.0/api/#tag/Write to try and get it to work, however it seems no matter what I try I am getting 401 unauthorized. I am sure that my API token is scoped correctly. I am passing in the organization ID under the org query param as per the docs, as well as the bucket ID in the bucket param.
This is not directly related to Veeam so I'm not sure if you could assist, but if you had any ideas it would be appreciated. We can move the discussion to a more private channel if you prefer.
Here is my edited curl from your script:
curl -i -X POST "$veeamInfluxDBURL:$veeamInfluxDBPort/api/v2/write?bucket=$veeamInfluxDB&org=$veeamInfluxDBOrg&precision=s" \ -H 'Content-type: text/plain; charset=utf-8' \ -H 'Authorization: Token $veeamInfluxDBToken' \ -H 'Accept: application/json' \ --data-binary "veeam_em_overview,host=$veeamRestServer veeamBackupServers=$veeamBackupServers,veeamProxyServers=$veeamProxyServers,veeamRepositoryServers=$veeamRepositoryServers,veeamRunningJobs=$veeamRunningJobs,veeamScheduledJobs=$veeamScheduledJobs,veeamSuccessfulVmLastestStates=$veeamSuccessfulVmLastestStates,veeamWarningVmLastestStates=$veeamWarningVmLastestStates,veeamFailedVmLastestStates=$veeamFailedVmLastestStates"
Which results in:
Writing veeam_em_overview to InfluxDB HTTP/1.1 401 Unauthorized Content-Type: application/json; charset=utf-8 X-Influxdb-Build: OSS X-Influxdb-Version: 2.1.1 X-Platform-Error-Code: unauthorized Date: Fri, 04 Feb 2022 21:38:59 GMT Content-Length: 55
{"code":"unauthorized","message":"unauthorized access"}
I can share InfluxDB details if needed.
— Reply to this email directly, view it on GitHub https://github.com/VeeamHub/grafana/issues/18#issuecomment-1030370959, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMBAHCDPDTP5PZ72CY26ATUZRBX3ANCNFSM5NSQ4Z6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
I tried that initially, because that is how the script was set up when I downloaded it. It results in the same errors. I think I will post on the InfluxDB community portal.
You should not use Org ID, but Org Name, make sure the uppercase and all are identical, same for bucket.
Here is my community post if you wanted to take a look at the InfluxDB details for my issue.
It says it doesn't exist. Do not post real tokens or passwords there.
Hope we can figure this out
On Fri, 4 Feb 2022, 22:34 Nolan Crooks, @.***> wrote:
Here is my community post https://community.influxdata.com/t/influxdb-v2-api-authorization-not-found-writing-to-bucket/23709 if you wanted to take a look at the InfluxDB details for my issue.
— Reply to this email directly, view it on GitHub https://github.com/VeeamHub/grafana/issues/18#issuecomment-1030404078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMBAHFFDDM3RQWOMKHJQJLUZRIARANCNFSM5NSQ4Z6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
I removed sensitive information. The post was hidden temporarily so that staff can review it. It's an anti spam measure
I switched to using influx
instead of curl
and it is working:
influx write -b Veeam "veeam_em_overview_vms,host=$veeamRestServer veeamProtectedVms=$veeamProtectedVms,veeamBackedUpVms=$veeamBackedUpVms,veeamReplicatedVms=$veeamReplicatedVms,veeamRestorePoints=$veeamRestorePoints,veeamFullBackupPointsSize=$veeamFullBackupPointsSize,veeamIncrementalBackupPointsSize=$veeamIncrementalBackupPointsSize,veeamReplicaRestorePointsSize=$veeamReplicaRestorePointsSize,veeamSourceVmsSize=$veeamSourceVmsSize,veeamSuccessBackupPercents=$veeamSuccessBackupPercents"
I don't have a solution for my authentication issues from before but this solution works for me. Hope it might help someone else down the road.
Hope we can figure this out
Hello, The Influx post doesn't show yet. Would you mind to share your config from the script, the influx part only, remove the token.
Using influx would works if you run the script from an influx server, and if you do not have https enabled.
I am thinking that the error was when adding the influxserver to the script, it needs http://IP or https://ip, not just IP
On Fri, 4 Feb 2022, 23:36 Nolan Crooks, @.***> wrote:
I switched to using influx instead of curl and it is working:
influx write -b Veeam "veeam_em_overview_vms,host=$veeamRestServer veeamProtectedVms=$veeamProtectedVms,veeamBackedUpVms=$veeamBackedUpVms,veeamReplicatedVms=$veeamReplicatedVms,veeamRestorePoints=$veeamRestorePoints,veeamFullBackupPointsSize=$veeamFullBackupPointsSize,veeamIncrementalBackupPointsSize=$veeamIncrementalBackupPointsSize,veeamReplicaRestorePointsSize=$veeamReplicaRestorePointsSize,veeamSourceVmsSize=$veeamSourceVmsSize,veeamSuccessBackupPercents=$veeamSuccessBackupPercents"
I don't have a solution for my authentication issues from before but this solution works for me. Hope it might help someone else down the road.
Hope we can figure this out
— Reply to this email directly, view it on GitHub https://github.com/VeeamHub/grafana/issues/18#issuecomment-1030434853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMBAHGNKAXNVECFX5BZDTDUZRPILANCNFSM5NSQ4Z6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
Hi, you can check the post again it is now visible.
Right, according to the Influx post you are using ID for the bucket, and for the Org, but the script says the next:
veeamInfluxDBURL="http://YOURINFLUXSERVERIP" #Your InfluxDB Server, http://FQDN or https://FQDN if using SSL veeamInfluxDBPort="8086" #Default Port veeamInfluxDBBucket="veeam" # InfluxDB bucket name (not ID) veeamInfluxDBToken="TOKEN" # InfluxDB access token with read/write privileges for the bucket veeamInfluxDBOrg="ORG NAME" # InfluxDB organisation name (not ID)
Or, on my case for example: veeamInfluxDBURL="https://yourinfluxserver" #Your InfluxDB Server, http://FQDN or https://FQDN if using SSL veeamInfluxDBPort="8086" #Default Port veeamInfluxDBBucket="telegraf" # InfluxDB bucket name (not ID) veeamInfluxDBToken="MYLONGTOKEN" # InfluxDB access token with read/write privileges for the bucket veeamInfluxDBOrg="Blog Jorge de la Cruz" # InfluxDB organisation name (not ID)
Hello @jorgedlcruz I have the same error trying this tool, I have data writing with telegraph from the VBR / VEM server to influx, however your script seems to fail with the following
400 Bad RequestWriting veeam_em_overview_jobs to InfluxDB HTTP/1.1 400 Bad Request Content-Type: text/plain; charset=utf-8 Connection: close
Followed your install procedure here
InfluxDB v2.4.0 is installed. following the above, should this still work?
Thanks
Hello, It works, I have it working in my lab with no issues at all. What type of licensing do you have? Please remember it should be Enterprise Plus or VUL.
You can try to debug a bit in the console, like for example try with this first:
veeamUsername="YOUREMUSER" #Your username, if using domain based account, please add it like user@domain.com (if you use domain\account it is not going to work!)
veeamPassword='YOUREMPASSWORD'
veeamJobSessions="100"
veeamAuth=$(echo -ne "$veeamUsername:$veeamPassword" | base64);
veeamRestServer="YOUREMSERVERIP"
veeamRestPort="9398" #Default Port
And then run:
curl -X POST "https://$veeamRestServer:$veeamRestPort/api/sessionMngr/?v=latest" -H "Authorization:Basic $veeamAuth" -H "Content-Length: 0" -H "Accept: application/json" -k --silent | awk 'NR==1{sub(/^\xef\xbb\xbf/,"")}1' | jq --raw-output ".SessionId"
Hello @jorgedlcruz I tried this with a separate V2.0 db influx server and returned the same results.
The test above returned a session code cfc92c0f---*-****
However Telegraf can talk to either db servers when the configuration is changed.
We are licenced to Enterprise Plus. just to note i also tried your test from the 4th of February and and it returned a result also.
curl -X POST "https://yourveeamemip:YOURPORT/api/sessionMngr/?v=latest" -H "Authorization:Basic $veeamAuth" -H "Content-Length: 0" -H "Accept: application/json" -k --silent | awk 'NR==1{sub(/^\xef\xbb\xbf/,"")}1'
Happy to run any other tests you have in mind.
Thanks
Hello, Thanks for trying, are you using http, or https on your influx server?
If the commands gives you results, then keep going, for example try this in the console: `##
veeamInfluxDBURL="http://YOURINFLUXSERVERIP" #Your InfluxDB Server, http://FQDN or https://FQDN if using SSL veeamInfluxDBPort="8086" #Default Port veeamInfluxDBBucket="veeam" # InfluxDB bucket name (not ID) veeamInfluxDBToken="TOKEN" # InfluxDB access token with read/write privileges for the bucket veeamInfluxDBOrg="ORG NAME" # InfluxDB organisation name (not ID)
veeamUsername="YOUREMUSER" #Your username, if using domain based account, please add it like user@domain.com (if you use domain\account it is not going to work!) veeamPassword='YOUREMPASSWORD' veeamJobSessions="100" veeamAuth=$(echo -ne "$veeamUsername:$veeamPassword" | base64); veeamRestServer="YOUREMSERVERIP" veeamRestPort="9398" #Default Port veeamSessionId=$(curl -X POST "https://$veeamRestServer:$veeamRestPort/api/sessionMngr/?v=latest" -H "Authorization:Basic $veeamAuth" -H "Content-Length: 0" -H "Accept: application/json" -k --silent | awk 'NR==1{sub(/^\xef\xbb\xbf/,"")}1' | jq --raw-output ".SessionId") veeamXRestSvcSessionId=$(echo -ne "$veeamSessionId" | base64);`
And then:
veeamEMUrl="https://$veeamRestServer:$veeamRestPort/api/reports/summary/overview" curl -X GET "$veeamEMUrl" -H "Accept:application/json" -H "X-RestSvcSessionId: $veeamXRestSvcSessionId" -H "Cookie: X-RestSvcSessionId=$veeamXRestSvcSessionId" -H "Content-Length: 0" 2>&1 -k --silent | awk 'NR==1{sub(/^\xef\xbb\xbf/,"")}1'
What does that give you? If you see a real JSON response, then keep trying the next: `veeamEMOUrl=$(curl -X GET "$veeamEMUrl" -H "Accept:application/json" -H "X-RestSvcSessionId: $veeamXRestSvcSessionId" -H "Cookie: X-RestSvcSessionId=$veeamXRestSvcSessionId" -H "Content-Length: 0" 2>&1 -k --silent | awk 'NR==1{sub(/^\xef\xbb\xbf/,"")}1')
veeamBackupServers=$(echo "$veeamEMOUrl" | jq --raw-output ".BackupServers")
veeamProxyServers=$(echo "$veeamEMOUrl" | jq --raw-output ".ProxyServers")
veeamRepositoryServers=$(echo "$veeamEMOUrl" | jq --raw-output ".RepositoryServers")
veeamRunningJobs=$(echo "$veeamEMOUrl" | jq --raw-output ".RunningJobs")
veeamScheduledJobs=$(echo "$veeamEMOUrl" | jq --raw-output ".ScheduledJobs")
veeamSuccessfulVmLastestStates=$(echo "$veeamEMOUrl" | jq --raw-output ".SuccessfulVmLastestStates")
veeamWarningVmLastestStates=$(echo "$veeamEMOUrl" | jq --raw-output ".WarningVmLastestStates")
veeamFailedVmLastestStates=$(echo "$veeamEMOUrl" | jq --raw-output ".FailedVmLastestStates")`
And finally:
curl -i -XPOST "$veeamInfluxDBURL:$veeamInfluxDBPort/api/v2/write?org=$veeamInfluxDBOrg&bucket=$veeamInfluxDBBucket&precision=s" -H "Authorization: Token $veeamInfluxDBToken" --data-binary "veeam_em_overview,host=$veeamRestServer veeamBackupServers=$veeamBackupServers,veeamProxyServers=$veeamProxyServers,veeamRepositoryServers=$veeamRepositoryServers,veeamRunningJobs=$veeamRunningJobs,veeamScheduledJobs=$veeamScheduledJobs,veeamSuccessfulVmLastestStates=$veeamSuccessfulVmLastestStates,veeamWarningVmLastestStates=$veeamWarningVmLastestStates,veeamFailedVmLastestStates=$veeamFailedVmLastestStates"
Hope it helps. I have Influx with valid SSL, etc. so it always worked, if you are using http, please change it on the variables.
Thanks for the information if i run the endpoint information, provided, after running the following command, all I get is > prompt. veeamXRestSvcSessionId=$(echo -ne "$veeamSessionId" | base64);`
Externally from this, if i run the below, I receive an array of Jason information. curl -X POST "https://***EMSIP***:9398/api/sessionMngr/?v=latest" -H "Authorization:Basic $veeamAuth" -H "Content-Length: 0" -H "Accept: application/json" -k --silent | awk 'NR==1{sub(/^\xef\xbb\xbf/,"")}1'
To note I am trying with HTTP requests, as the ubuntu host with Influx on is standalone currently.
Thanks
This was resolved by creating a new organisation in the end without spaces in the name.
In the folder containing the
veeam_enterprisemanager.sh
script, the README.md states:However looking over the files in the directory and subdirectories, this script is no where to be found. Is it missing?
This is relevant to me because I am getting errors such as:
When attempting to use the veeam_enterprisemanager.sh script with InfluxDB 2.0.