Monitoring Samba users, shares, and connections with Xymon

I thought it would be a good idea to monitor some basic stats from the Samba servers that we manage and maintain. It would be nice, for example, to know the total number of users in the domain (LDAP, or tbd), the total number of machines in the domain, the number of currently connected users, the number of currently opened shares, and total number of open files.

Of course, if we have all of this information, we are going to graph it too!

Below is a short Xymon external script (bash shell script) which gathers this information using pdbedit, smbldap-userlist, and smbstatus and reports the information back to the Xymon server.