Agentless Disk space monitoring
-
tmattingly
- Posts: 115
- Joined: Thu Oct 23, 2014 12:53 pm
Agentless Disk space monitoring
I am running Nagios 5.2.7 as a VM
I have a few Windows servers (2003/2008 r2/2012/2012 r2) and Windows 7 workstations 32 bit that I would like to 'agentlessly' monitor disk space usage <85% alert for example. I've looked through the plugins but I am not sure the best and easiest way to do it. Which method is the best and easiest? Any examples greatly appreciated once I know which one is the one to use.
How do I do this?
Thank you,
Tom
I have a few Windows servers (2003/2008 r2/2012/2012 r2) and Windows 7 workstations 32 bit that I would like to 'agentlessly' monitor disk space usage <85% alert for example. I've looked through the plugins but I am not sure the best and easiest way to do it. Which method is the best and easiest? Any examples greatly appreciated once I know which one is the one to use.
How do I do this?
Thank you,
Tom
Re: Agentless Disk space monitoring
WMI is one option you might consider. Nagios XI comes with the check_wmi_plus.pl plugin:
You could also use the "Windows WMI" wizard to configure it.
Code: Select all
[root@localhost libexec]# /usr/local/nagios/libexec/check_wmi_plus.pl -H <host> -u '<username>' -p '<password>' -m checkdrivesize -a 'C': -w '80' -c '95'
OK - C: Total=50.23GB, Used=17.38GB (34.6%), Free=32.86GB (65.4%) |'C: Space'=17.38GB; 'C: Utilisation'=34.6%;80;95;
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
tmattingly
- Posts: 115
- Joined: Thu Oct 23, 2014 12:53 pm
Re: Agentless Disk space monitoring
When I try the gui (with no firewalls turned on and the windows machine is pingable) I get... The wizard detected that the WMI plugin returned an unsuccessful output code. This will prevent the automatic scan of services and processes and prevent services from running successfully. Below is the given error output: (The window below is blank, its empty).
How do I proceed?
How do I proceed?
Re: Agentless Disk space monitoring
Was the wizard able to properly detect all the disks on the remote machine?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
tmattingly
- Posts: 115
- Joined: Thu Oct 23, 2014 12:53 pm
Re: Agentless Disk space monitoring
No, it does not appear to. I tried two different servers. One with a single c: drive and another with multiple drives and they both only default to c:
Re: Agentless Disk space monitoring
Is the Windows user you are attempting to use able to login to the remote system? Is the account also configured to allow for remote usage of that account?
From the CLI of the Nagios XI server, can you run the following replacing the <> bits with your info:
From the CLI of the Nagios XI server, can you run the following replacing the <> bits with your info:
Code: Select all
/usr/local/nagios/libexec/check_wmi_plus.pl -H <windows_host> -u <user> -p <pass> -m checkdrivesize -a .Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
tmattingly
- Posts: 115
- Joined: Thu Oct 23, 2014 12:53 pm
Re: Agentless Disk space monitoring
Yes, I can remote in and I am a local admin on the server...
At the command line I get...
The variable '$base_dir' in /etc/check_wmi_plus/check_wmi_plus.conf is not set to a valid directory at /usr/local/nagios/libexec/check_wmi_plus.pl line 305.
You have new mail in /var/spool/mail/root
At the command line I get...
The variable '$base_dir' in /etc/check_wmi_plus/check_wmi_plus.conf is not set to a valid directory at /usr/local/nagios/libexec/check_wmi_plus.pl line 305.
You have new mail in /var/spool/mail/root
Re: Agentless Disk space monitoring
Run the following:
This should spit out a Perl variable, might look something like this:
Please post the contents of the file that $conf_file is pointing to.
Code: Select all
cat /usr/local/nagios/libexec/check_wmi_plus.pl | grep conf_file=Code: Select all
[root@localhost libexec]# cat /usr/local/nagios/libexec/check_wmi_plus.pl | grep conf_file=
my $conf_file='/usr/local/nagios/libexec/check_wmi_plus.conf';Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
tmattingly
- Posts: 115
- Joined: Thu Oct 23, 2014 12:53 pm
Re: Agentless Disk space monitoring
Code: Select all
# Check WMI Plus Config file
# This is read in-line into the perl program, so the syntax has to be just right.
# The settings in here override the default settings in the plugin code
# This file is only required if you want to change the default settings in the plugin
# It is provided in the release package as check_wmi_plus.conf.sample
# Rename it to check_wmi_plus.conf and/or set its location right at the top of the check_wmi_plus.pl script
# this file makes it easier to upgrade the plugin since you can keep your old settings in your own copy of this file
# ---------------------- FILE LOCATIONS -------------------------
# we are looking for the dir where utils.pm is located. This is normally installed as part of Nagios
use lib "/usr/local/nagios/libexec"; # CHANGE THIS IF NEEDED
# Set the full path where the plugin is installed
# You might not even use this variable if you have different locations for everything
# as a first guess, grab the directory that this conf file lives in
$base_dir="/usr/local/nagios/libexec"; # CHANGE THIS IF NEEDED
# This is the full path location of the wmic command
# - standard value "$base_dir/wmic"
$wmic_command="/usr/bin/wmic"; # CHANGE THIS IF NEEDED
# you do not need to use this if you are using $wmi_ini_dir
# normally you would only use this if you had a single specific ini file you wanted to use
# set the location of the ini file. Set to '' if not using it or specify using the --inifile parameter
# set this to something else if you want
# - standard value "$base_dir/check_wmi_plus.ini"
$wmi_ini_file='/usr/local/nagios/libexec/check_wmi_plus.ini'; # CHANGE THIS IF NEEDED
# set the location of the ini dir. Set to '' if not using it or specify using the --inidir parameter
# set this to something else if you want
# you might like to use "$base_dir/wmic"
# - standard value "$base_dir/check_wmi_plus.d"
$wmi_ini_dir="/usr/local/nagios/libexec"; # CHANGE THIS IF NEEDED,
# set the location of temporary directory - used for keep state option
$tmp_dir='/tmp'; # CHANGE THIS IF NEEDED
# this script helps with making the manpage help. By default it is in the same directory as the plugin itself
$make_manpage_script="$base_dir/check_wmi_plus.makeman.sh"; # CHANGE THIS IF NEEDED
# this is the directory where the manpage is stored when created, defaults to the same directory as the ini files
$manpage_dir="$wmi_ini_dir"; # CHANGE THIS IF NEEDED
# PRO only: set the location of where the check_wmi_plus will store some persistent data
# - standard value "$conf_file_dir/check_wmi_plus.data"
$wmi_data_dir="$conf_file_dir/check_wmi_plus.data";
# PRO only: this is the file where the usage stats are stored (if using it via $collect_usage_info or --icollectusage)
$usage_db_file="$wmi_data_dir/check_wmi_plus.usagedb";
# PRO only: this is the file where the compiled ini files are stored
$compiled_ini_file="$wmi_data_dir/check_wmi_plus.compiledini";
# ---------------------- OTHER CONFIGURATION -------------------------
# Disable the check of Perl Module versions
# The module versions are checked because the are often the cause of the plugin not working correctly
# If you want support you will need to reproduce the fault with the supported versions of the modules ie enable this check
# Set to 1 to ignore the version check, Set to 0 to perform the check
# Setting this to 1 has the same effect as the command line option --IgnoreMyOutDatedPerlModuleVersions
# Setting either this to 1 or the command line option will disable the check
$ignore_my_outdated_perl_module_versions=1; # CHANGE THIS IF NEEDED
# force the use of the wmic command line binary. Set to 1 to force
# this is used if you have the wmiclient library installed but want to use the command line version
$force_wmic_command=0; # CHANGE THIS IF NEEDED
# used cached wmic responses
# you don't really want this on unless you want to totally bypass wmic
# some checks will totally fail with this set
# all your check response will be inaccurate
$use_cached_wmic_responses=0;
# extra wmic args
# specify standard additional arguments to pass directly to the wmic command line for ALL invocations of wmic
# Note that the command line parameter --extrawmicarg is also available if you need this on a case by case basis
# This is an array so you need to put each argument into a separate array index
# eg @opt_extra_wmic_args=( "argument1=value1", "argument2=value2" );
# should be set to @opt_extra_wmic_args=() if not used
# extra wmic arguments specified on the command line are added to the ones specified here
our @opt_extra_wmic_args=(); # extra arguments to pass to wmic
# ------------------------ PRO Library Options -------------------------
# PRO Only:
# collect various usage info and store it in $usage_db_file for later analysis
# also available by using the --icollectusage command line parameter
# requires additional perl modules if invoked
# turning this on adds a relatively large elapsed time penalty (relative to the execution time of the program)
$collect_usage_info=1;
# PRO Only:
# show various usage info at end of plugin output
# also available by using the --ishowusage command line parameter
# requires additional perl modules if invoked
$show_usage_info=1;
# Pro Only:
# Generate a Nagios error if there is a problem updating the usage stats
# If set to 0, errors updating usage stats will be shown in the plugin output but will not impact the Nagios alert type
$generate_nagios_error_for_usage_stats_problem=1;
# Pro Only:
# use compiled ini files for additional speed (reduces CPU and Elapsed times)
$use_compiled_ini_files=0;
# Pro Only:
# force reading of the ini files - you may want to do this if you are doing a non-ini file check and you are using variables defined in an ini file
# only use this if you really needed it since it makes each invocation of the plugin a lot slower
$force_ini_open=0;
[root@fai0nagiosxi libexec]#
Last edited by mcapra on Wed Aug 10, 2016 4:32 pm, edited 1 time in total.
Reason: please wrap long/technical outputs in [code] tags
Reason: please wrap long/technical outputs in [code] tags
Re: Agentless Disk space monitoring
Can you zip up and upload the "check_wmi_plus.pl" plugin that you are using?
Have you configured the Windows machine according to the instructions in our documentation?
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Have you configured the Windows machine according to the instructions in our documentation?
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!