All file size from a drive nagios xi
All file size from a drive nagios xi
Hello,
I just need to ask about the subjected problem that Is there any way to monitor all folders/directory sizes using nagios xi for windows servers using below protocols
1-check_nt
2-check_nrpe
If any please help me out.
Thank you very much!
I just need to ask about the subjected problem that Is there any way to monitor all folders/directory sizes using nagios xi for windows servers using below protocols
1-check_nt
2-check_nrpe
If any please help me out.
Thank you very much!
Re: All file size from a drive nagios xi
You can monitor the drive/partition size, and you can monitor individual directories, but I don't know of a way to monitor all folders without spending a lot of time setting each one up individually.
Here's an example of a plugin to check directory size in Windows:
https://exchange.nagios.org/directory/P ... bs/details
I would suggest checking the Exchange for other plugins that may suit your needs.
Here's an example of a plugin to check directory size in Windows:
https://exchange.nagios.org/directory/P ... bs/details
I would suggest checking the Exchange for other plugins that may suit your needs.
Former Nagios employee
Re: All file size from a drive nagios xi
Can anyone else let me something know about it.
Thank you!
Thank you!
Re: All file size from a drive nagios xi
Are you able to share more about what exactly your use case is? It's hard to say whether or not a specific thing can be done with a specific plugin without specific details.
If you're using NSClient++ 0.4.3 or greater, you can do some things with CheckDisk and clever filtering:
http://docs.nsclient.org/0.4.3/referenc ... kDisk.html
If you're using NSClient++ 0.4.3 or greater, you can do some things with CheckDisk and clever filtering:
http://docs.nsclient.org/0.4.3/referenc ... kDisk.html
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: All file size from a drive nagios xi
Thank you for your reply!
My requirements are as follows:
I have a drive C:\, it contains e.g 20 files are this drive consumed 80 % of space, but we dont know which files are consuming maximum space.
I want to monitor all files are their occupied space status on it.
Like it should state that file abc.txt is of 5 gb etc
Hope so I will be able to make you understand my requirement.
Thank you!
My requirements are as follows:
I have a drive C:\, it contains e.g 20 files are this drive consumed 80 % of space, but we dont know which files are consuming maximum space.
I want to monitor all files are their occupied space status on it.
Like it should state that file abc.txt is of 5 gb etc
Hope so I will be able to make you understand my requirement.
Thank you!
Re: All file size from a drive nagios xi
I am fairly certain this is not something you could do from NSClient without leveraging a custom plugin for it.
The following powershell one-liner can print off the top 10 largest files for a given path:
Replace C:\ with your desired path. You might alter an existing powershell script on the exchange that is checking disk size to include the command above. I was able to have some success with modifying this plugin:
https://exchange.nagios.org/directory/P ... pt/details
The main problem is that getting this sort of data from the disk is going to take an awfully long time depending on the file count. On my fresh minimal Server 2012 environment, that command by itself took a little shy of 30 seconds to run.
The following powershell one-liner can print off the top 10 largest files for a given path:
Code: Select all
gci -r C:\ -ea 0 | sort Length -desc | select -f 10
https://exchange.nagios.org/directory/P ... pt/details
The main problem is that getting this sort of data from the disk is going to take an awfully long time depending on the file count. On my fresh minimal Server 2012 environment, that command by itself took a little shy of 30 seconds to run.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: All file size from a drive nagios xi
There are some file based checks in NSClient++, have a look at this link which provides examples on "Files Greater Than A Size".
http://sites.box293.com/nagios/guides/c ... es-folders
http://sites.box293.com/nagios/guides/c ... es-folders
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: All file size from a drive nagios xi
I have attached the command from which its listing down all the files those are of size greater than 1 gb upon my set thresholds.
I dont want to monitor file size from a directory/folder,
I want to monitor the folder sizes in gb not file size,
Please assist
Thank you!
I dont want to monitor file size from a directory/folder,
I want to monitor the folder sizes in gb not file size,
Please assist
Thank you!
You do not have the required permissions to view the files attached to this post.
Re: All file size from a drive nagios xi
Just to be clear, you want to have a check that tells you how much space all of the files in one folder takes up on the system?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: All file size from a drive nagios xi
Here's a powershell script I hacked together that might offer some assistance. I make no claims it will solve your use case, only that is does the things described below. Based on this plugin:
https://exchange.nagios.org/directory/P ... pt/details
Usage and outputs:
If a disk is in a critical/warning state, it will print the sizes of every top-level folder on that disk. From the original plugin:
https://exchange.nagios.org/directory/P ... pt/details
Code: Select all
# Get fixed drive info for specified server
param([string] $warn, [string] $crit)
###################################
# Top Largest Folders Scan
###################################
Function folderScan($rootLocation) {
$subDirectories = Get-ChildItem $rootLocation | Where-Object{($_.PSIsContainer)} | foreach-object{$_.Name}
foreach ($i in $subDirectories)
{
$targetDir = $rootLocation + $i
$folderSize = (Get-ChildItem $targetDir -Recurse -Force | Measure-Object -Property Length -Sum).Sum 2> $null
$folderSizeComplete = "{0:N0}" -f ($folderSize / 1GB) + "GB"
Write-Host $findFilesFoldersOutput "$targetDir , $folderSizeComplete"
}
}
$alertcrit = 0
$alertwarn = 0
$error.clear()
$disks = Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType = 3";
foreach($disk in $disks)
{
$deviceID = $disk.DeviceID;
[float]$size = $disk.Size;
[float]$freespace = $disk.FreeSpace;
$percentFree = [Math]::Round(($freespace / $size) * 100, 2);
$sizeGB = [Math]::Round($size / 1073741824, 2);
$freeSpaceGB = [Math]::Round($freespace / 1073741824, 2);
if($percentFree -lt $crit -and $freeSpaceGB -lt 5)
{
Write-Host "CRITICAL $deviceID = $percentFree% Free!";
$alertcrit = 1
folderScan "$deviceID\"
}
elseif($percentFree -lt $warn -and $freeSpaceGB -lt 10)
{
Write-Host "WARNING $deviceID = $percentFree% Free!";
$alertwarn = 1
folderScan "$deviceID\"
}
Else
{
Write-Host "$deviceID=$percentFree% Free"
}
}
if ($alertcrit -gt 0)
{
exit 2
}
elseif ($alertwarn -gt 0)
{
exit 1
}
elseif ($error.Count -gt 0)
{
Write-Output $_;
$_="";
exit 3;
}
else
{
exit 0
}
Code: Select all
PS C:\> ./diskcheck.ps1 20 10
C:=71.91% Free
E:=21.44% Free
PS C:\> ./diskcheck.ps1 22 10
C:=71.91% Free
WARNING E: = 21.44 % Free!
E:\big folder , 7GB
E:\small folder , 0GB
PS C:\>
[parameters are] warn & crit thresholds (in free %s). It won't alert unless those thresholds are met AND the total free space is less than 10GB for warning, 5GB for critical.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/