Home Directory Addons Active Checks check_smb_usedspace

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_smb_usedspace

Rating
0 votes
Favoured:
0
Current Version
0.03
Last Release Date
2014-04-04
Compatible With
  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI
Owner
Hits
20096
Files:
FileDescription
check_smb_usedspacePlugin for GNU/Linux 32-bit server
check_smb_usedspace_x64Plugin for GNU/Linux 64-bit server
main.cppMain source file (C++)
gengetopt.ggoGengetopt source file
cmdline.cGengetopt generated file
cmdline.hGengetopt generated file

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

This very simple plugin is writen in C++. The goal is to retrieve the used space on a samba share. check_smb_share is not ok for me because we need authorized access to all directories. We need the used space and not the free space because we pay about the GB and the disk size is not always the same.
This is the very very very first draft of a function which I didn't find on Nagios Exchange. I publish it with the GPL v3 license. You are very encouraged to help me to improve this plugin.


Doc for user :

You need first :
- package to mount cifs/smb share (on Debian, this is cifs-utils)
- Install sudo and config sudoers conf file to give to nagios user the right to mount a cifs/smb share, umount a share, and to change PASSWD variable.
My /etc/sudoers file :
----------
Defaults env_reset
Defaults env_keep += "PASSWD"
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local bin:/usr/sbin:/usr/bin:/sbin:/bin"

Cmnd_Alias MOUNTCIFS = /sbin/mount.cifs, /bin/umount

root ALL=(ALL:ALL) ALL
nagios ALL = NOPASSWD: MOUNTCIFS
%sudo ALL=(ALL:ALL) ALL

#includedir /etc/sudoers.d
----------

- Use check_smb_usedspace --help to obtain the command syntax. Don't forget to multiply by 4 backslash characters.



Developpers doc :
To just modify the main.cpp source file :
- Place main.cpp, cmdline.c and cmdline.h in a directory.
- Edit what you want in the file.
- My simple command to compile is #g++ main.cpp cmdline.c cmdline.h -o check_smb_usedspace
You juste need Gcc/G++ compiler and C/C++ standard libraries.

To modify the --help interface, or options to put in the command line :
- Place main.cpp and gengetopt.ggo in a directory.
- Edit the gengetopt file (doc : https://www.gnu.org/software/gengetopt/ )
- Install Gengetopt and use this command : "gengetopt < gengetopt.ggo"
- My simple command to compile is "g++ main.cpp cmdline.c cmdline.h -o check_smb_usedspace"
You juste need Gcc/G++ compiler and C/C++ standard libraries.


I will very happy if you report me bugs, patchs, suggestions, or if you give me your opinion.