On and Off in this forum over the years, the idea of a NOC dashboard has been floated a few times. Some members have posted screenshots of their custom solutions, but nobody has been brave enough to post their source code, which has stifled further development of a suitable tool anyone can implement.
Until now. So, here it is, a fully working sample NOC written in PHP, complete with 3 sample SQL procedures and all the sourcecode and instructions you need to make it work.
To use it, install a Web Server and PHP - personally I used the pre-built XAMPP webserver package on my laptop, but anything that can run PHP will work e.g. IIS, Generic Apache install etc.. NB: I strongly suggest you don't use your Kaseya Server for this!!! Test it out on a workstation or something similar and get to know what you're doing, before you go forward. The only prerequisite is the machine you install all of this on must be able to connect to your Kaseya SQL database.
Create your website and dump all the files in the attached ZIP file into it.
Ensure PHP has the MS-SQL extensions installed - download them here http://www.microsoft.com/en-au/download/details.aspx?id=20098 you'll also need to install the SQL2012 native client from http://www.microsoft.com/en-au/download/details.aspx?id=29065
Edit the dblogin.php file and change kserver.mycompany.local to the name of your SQL server. Also enter valid credentials in the UID and PWD fields (If your SQL is in mixed mode, leave the username as sa and enter your sa password in the PWD field).
Load the index.php in your browser. Enjoy!
The page auto-refreshes every 5 seconds, and uses AJAX to dynamically update page content, so the whole page doesn't go blank every time it refreshes. I designed it so I could set up an old machine to drive a TV on the wall - the machine auto-runs the browser on boot, which has the homepage set to the NOC screen, so just boot it and watch. No user interaction is ever required.
I will be very happy to take comments and feedback here! This code is pretty crude and thrown together fairly quickly as a proof-of-concept idea mostly. I am looking forward to hearing from like-minded Kaseya users who want to further develop this into something very usable. Let me know your thoughts!!!
Thanks for posting this Craig. When I find some time I'll throw it onto a machine and see how it looks.
This only works on Windows web servers with Windows PHP :(
Can you make it work with *nix based webservers and utilize mssql_*() functions instead of the sqlsrv_*() functions?
Yes, my code only works with Windows as it uses the Microsoft SQL PHP libraries. It should be trivial to convert back to the native PHP MSSQL libraries, but as I don't use them, you'll have to do this yourself. I targeted Windows, as, well thats what Kaseya is really all about and runs on. In any case, just replace all the calls to sqlsrv_ with the equivalent mssql_ calls - you may need to adjust a few parameters here and there e.g. I think the open SQL connection call is different.
Very cool. Thanks for posting this Craig.
Yeah no big problem, I got it to work with mssql calls in Linux. Looks great man!
Also, while changing your code, I noticed that you're not utilizing the sqlsrv_free_stmt() nor the sqlsrv_close() calls to free resources when you're done with them. The memory gods and clean code gods will thank you if you do :)
Keep up the good work!
PHP Automatically closes the connection at the end of the script - but yes point taken if you want to be ultra certain about the code, you can add a call to close the connection if you wish.
I would love to see screenshots of this when people get it running. Sounds pretty cool.
If anyone wants it, I've modified this to work on Linux with newer PHP (> 5.2) which no longer support the mssql_* calls. It requires installation and configuration of FreeTDS. Steps are as follows:
1. Follow these instructions to install and configure FreeTDS. Note, do this as your web user (or ensure the web user has full permissions to the FreeTDS odbc config files)
2. Untar the attached file in the desired webhosting directory and edit the dblogin.php to set your DB access vars as per your FreeTDS ODBC configuration.
3. Edit the blank logo.jpg provided to your desired logo (if you can be bothered)
4. Ensure you have the php5-odbc libs installed.
That's it, you should be good to go.
Have a screenshot:
Latest screengrab..... SQL queries are so much fun :)
Craig, Thanks for posting...been playing around with this and so here is where we have gotten.
Wow, that looks great! Your screengrab is fairly low resolution (when posting, change the default 500 pixels in the post-editor-pic-uploader to 1000) but I see you've developed some more queries e.g. users locked out, and some stats across the top with nice icons. Would you care to elaborate what statistics you are finding useful to have, and also perhaps share the SQL behind these please?
I'm sure everyone here would really enjoy building a library of SQL queries; I am also particularly interested in what stats you are finding useful to see in your NOC...
can you detail the steps you did to get your Network Operations Center status working ?
Just installed the XAMPP but in the control panel error msg
port 80 in use by other application - uninstall this application
or reconfigure apache to listen on another port.
can you help / assist on this matter ? How to reconfigure apache ?
If you're using skype, close skype. Skype tends to use port 80 sometimes. or change the settings in options - advanced - connection and uncheck the use port 80 and 443.
Otherwise run netstat -nb to see which application uses port 80.
You can always use google for an answer.