Skip to content

Commit

Permalink
Merge pull request #377 from sexibytes/develop
Browse files Browse the repository at this point in the history
Merge before release 0.99j - St. Olga
  • Loading branch information
rschitz authored Feb 12, 2024
2 parents bb2340d + ebde157 commit 4dd0d26
Show file tree
Hide file tree
Showing 63 changed files with 4,874 additions and 549 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ The metrics used in the various VSAN dashboards are now collected every 5 minute

Fast. Very fast. That’s what we had in mind when we designed SexiGraf. When you need vSphere metrics, the obvious way is the `PerformanceManager`, but we need something faster so we choosed managed object properties and quickstats like `ResourcePoolQuickStats`. If we have no other choice, we failback to the `PerformanceManager` but we only query the last 15 samples of the `RealTime samplingPeriod` since we pull vSphere metrics every 5 minutes. http://www.sexigraf.fr/vsphere-sexipanels/  

## FreeNAS
## FreeNAS/TrueNAS

Starting from version 9.10, FreeNAS allows users to set a “Remote Graphite Server” target to send all the metrics harvested by Collectd. Guess what would make a nice Graphite target! http://www.sexigraf.fr/freenas-sexipanel/
Starting from version 9.10, FreeNAS/TrueNAS allows users to set a “Remote Graphite Server” target to send all the metrics harvested by Collectd. Guess what would make a nice Graphite target! http://www.sexigraf.fr/freenas-sexipanel/

## Windows

Expand Down
24 changes: 23 additions & 1 deletion etc/apache2/sites-available/graphite.conf
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,32 @@ ExtendedStatus On
ProxyPass /sexiadmin/ !
Alias /sexiadmin/ /var/www/admin/
<Directory /var/www/admin/>
Order allow,deny
RewriteEngine On
RewriteCond %{HTTP_REFERER} /sexigraf-web-admin [NC,OR]
RewriteCond %{HTTP_REFERER} /sexiadmin/ [NC]
RewriteRule .* - [L]
RewriteRule .* - [F]
</Directory>

ProxyPass /sexihistory/ !
Alias /sexihistory/ /mnt/wfs/inventory/
<Directory /mnt/wfs/inventory/>
RewriteEngine On
RewriteCond %{HTTP_REFERER} /sexigraf-web-admin [NC,OR]
RewriteCond %{HTTP_REFERER} /sexiadmin/ [NC]
RewriteRule .* - [L]
RewriteRule .* - [F]
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Allow from all
</Directory>

<Files "vipscredentials.xml">
Order Allow,Deny
Deny from all
</Files>

ProxyPass /favicon.ico !
Alias /favicon.ico /var/www/admin/images/favicon.ico

Expand Down
1 change: 1 addition & 0 deletions etc/cron.d/xMotionGarbageCollector
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
37 1 * * * root /usr/bin/pwsh -NonInteractive -NoProfile -f /opt/sexigraf/xMotionGarbageCollector.ps1 >/dev/null 2>&1
25 changes: 25 additions & 0 deletions etc/grafana/provisioning/dashboards/Veeam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: 1

providers:
# <string> an unique provider name
- name: 'Veeam'
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string, required> name of the dashboard folder. Required
folder: 'Veeam Backup & Replication'
# <string> folder UID. will be automatically generated if not specified
# CRC32 of name
folderUid: '30fb6004'
# <string, required> provider type. Required
type: file
# <bool> disable dashboard deletion
disableDeletion: false
# <bool> enable dashboard editing
editable: true
# <int> how often Grafana will scan for changed dashboards
updateIntervalSeconds: 10
# <bool> allow updating provisioned dashboards from the UI
allowUiUpdates: false
options:
# <string, required> path to dashboard files on disk. Required
path: /var/lib/grafana/dashboards/Veeam
2 changes: 1 addition & 1 deletion etc/sexigraf_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.99i "Victory Mine"
0.99j "St. Olga"
32 changes: 31 additions & 1 deletion opt/graphite/conf/storage-aggregation.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,34 @@ aggregationMethod = sum
[errorsTx]
pattern = .\.errorsTx.
xFilesFactor = 0.0
aggregationMethod = sum
aggregationMethod = sum

[PathState]
pattern = .\.superstats\.PathState\.*
xFilesFactor = 0.0
aggregationMethod = last

[overallStatus]
pattern = .\.quickstats\.overallStatus\.*
xFilesFactor = 0.0
aggregationMethod = last

[veeamObjectRestorePoints]
pattern = ^veeam.*\.objectRestorePoints
xFilesFactor = 0.0
aggregationMethod = sum

[veeamRestorePointsCount]
pattern = ^veeam.*\.restorePointsCount
xFilesFactor = 0.0
aggregationMethod = last

[veeamResult]
pattern = ^veeam.*\.result
xFilesFactor = 0.0
aggregationMethod = last

[veeamStatus]
pattern = ^veeam.*\.status
xFilesFactor = 0.0
aggregationMethod = last
16 changes: 11 additions & 5 deletions opt/graphite/conf/storage-schemas.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

# Carbon's internal metrics. This entry should match what is specified in
# CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings
# https://m30m.github.io/whisper-calculator/

[carbon]
pattern = ^carbon\.
retentions = 60:90d
Expand All @@ -36,20 +38,24 @@ retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d,2880m:1y

[vsan_sync]
pattern = .*\.vsan\.SyncingVsanObjects\.
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d
retentions = 5m:24h,10m:48h,30m:96h,60m:7d,240m:30d,720m:90d

[vsan_smart]
pattern = .*\.vsan\.disk\.smart\.
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d,2880m:1y
retentions = 5m:24h,10m:48h,30m:96h,60m:7d,240m:30d,720m:90d,2880m:1y

[vsan_spaceDetail]
pattern = .*\.vsan\.spaceDetail\.
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y
retentions = 5m:24h,10m:48h,30m:96h,60m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y

[vsan]
pattern = ^vsan\.
retentions = 5m:12h,10m:24h,20m:48h,80m:7d,320m:30d,640m:90d
retentions = 5m:12h,10m:24h,20m:48h,40m:96h,80m:7d,320m:30d,640m:90d

[veeam]
pattern = ^veeam\.
retentions = 5m:7d,10m:30d,15m:90d,30m:120d,120m:1y

[anything_else]
pattern = .*
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y
retentions = 5m:24h,10m:48h,30m:96h,60m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y
4 changes: 4 additions & 0 deletions opt/sexigraf/PullGuestInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ try {

if ($VmwCmdOvfEnvGuest["guestinfo.dns"] -and ([regex]::match($($VmwCmdOvfEnvGuest['guestinfo.dns']), '^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$')).Success) {
$EtcNetworkInterfaces += " dns-nameservers $($VmwCmdOvfEnvGuest['guestinfo.dns'])"
} elseif ($VmwCmdOvfEnvGuest["guestinfo.dns"] -and ([regex]::match($($VmwCmdOvfEnvGuest['guestinfo.dns']), '^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}) ([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$')).Success) {
$EtcNetworkInterfaces += " dns-nameservers $($VmwCmdOvfEnvGuest['guestinfo.dns'])"
} elseif ($VmwCmdOvfEnvGuest["guestinfo.dns"] -and ([regex]::match($($VmwCmdOvfEnvGuest['guestinfo.dns']), '^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}) ([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}) ([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$')).Success) {
$EtcNetworkInterfaces += " dns-nameservers $($VmwCmdOvfEnvGuest['guestinfo.dns'])"
}

if ($VmwCmdOvfEnvGuest["guestinfo.domain"] -and ([regex]::match($($VmwCmdOvfEnvGuest['guestinfo.domain']), '([a-zA-Z]+)')).Success) {
Expand Down
32 changes: 32 additions & 0 deletions opt/sexigraf/VbrConnect.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/pwsh -NonInteractive -NoProfile -Command
#
param([Parameter (Mandatory=$true)] [string] $server, [Parameter (Mandatory=$true)] [string] $username, [Parameter (Mandatory=$true)] [string] $password)

# https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/PowerCLI-on-Debian-Stretch-The-type-initializer-for-VMware/m-p/451739#M10646
Set-Content -Path Env:HOME -Value '/tmp'

if (!$(Test-Connection -TargetName $server -TcpPort 9419 -TimeoutSeconds 2)) {
Write-Host "$server is not answering at TCP:9419 check if VeeamBackupRESTSvc is running"
exit 1
}

try {
$VbrHeaders = @{"accept" = "application/json";"x-api-version" = "1.0-rev1"}
$VbrBody = @{grant_type = "password";username = $username;password = $password;refresh_token = "";code = "";use_short_term_refresh = ""}
$VbrConnect = Invoke-RestMethod -SkipHttpErrorCheck -SkipCertificateCheck -Method POST -Uri $("https://" + $server + ":9419/api/oauth2/token") -Headers $VbrHeaders -ContentType "application/x-www-form-urlencoded" -Body $VbrBody
if ($VbrConnect.access_token) {
$SessionSecretName = "vbr_" + $server.Replace(".","_") + ".key"
$SessionRefresh = "vbr_" + $server.Replace(".","_") + ".dat"
$VbrConnect.access_token | Out-File -FilePath /tmp/$SessionSecretName
$VbrConnect.refresh_token | Out-File -FilePath /tmp/$SessionRefresh
Write-Host "Connected to $server"
} else {
Write-Host "Connection to $server failed!"
exit 1
}
} catch {
# Invoke-RestMethod: Unable to read data from the transport connection: Connection reset by peer.
# https://helpcenter.veeam.com/docs/backup/vbr_rest/tls_certificate.html
Write-Host "$($Error[0])"
exit 1
}
Loading

0 comments on commit 4dd0d26

Please sign in to comment.