Git Product home page Git Product logo

phpservermon's Introduction

PHP Server Monitor

Join the chat at https://gitter.im/erickrf/nlpnet huntr

Version 3.6.0.beta2

PHP Server Monitor is a script that checks whether your websites and servers are up and running. It comes with a web based user interface where you can manage your services and websites, and you can manage users for each server with a mobile number and email address.

Features:

  • Monitor services and websites (see below).
  • Email, SMS, Discord, Pushover, Telegram and Jabber notifications.
  • View history graphs of uptime and latency.
  • User authentication with 2 levels (administrator and regular user).
  • Logs of connection errors, outgoing emails and text messages.
  • Easy cronjob implementation to automatically check your servers.

There are two different ways to monitor a server:

  • Service

    A connection will be made to the entered ip or domain, on the given port. This way you can check if certain services on your machine are still running. To check your IMAP service for example, enter port 143.

  • Website

    You can enter a link to a website, it will then use cURL to open the website and check the HTTP status code. If the HTTP status code is in the 4xx/5xx, it means an error occurred and the website is not accessible to the public. You can also set a regular expression to match for content on the page itself. If the regular expression returns no matches, the website is considered down. In both cases the script will return a "status offline", and will start sending out notifications.

Each server has its own settings regarding notification. You can choose for email, text message (SMS), Pushover.net, Telegram and Jabber notifications. The following SMS gateways are currently available:

Please note: for these gateways you will need an account with sufficient credits.

Download

The latest version can be downloaded from https://github.com/phpservermon/phpservermon/releases.

Requirements

  • Web server
  • MySQL database
  • For PHP5: 5.5.9+
  • For PHP7: 7.0.8+
  • PHP Extensions (modules)
    • ext-curl
    • ext-ctype
    • ext-filter
    • ext-hash
    • ext-json
    • ext-libxml
    • ext-openssl
    • ext-pdo
    • ext-pcre
    • ext-sockets
    • ext-xml

Install

Please see docs/install.rst. In a nutshell: unzip, upload, run install.php, enjoy.

If you have downloaded the source from GitHub (and not a pre-built package), the dependencies are not included. To be able to run an installation from the repo, you need to run the following command to install the dependencies:

php composer.phar install

If you are familiar with Vagrant (https://www.vagrantup.com):

vagrant up

Documentation

The documentation is available in the docs folder or https://docs.phpservermonitor.org.

License

PHP Server Monitor is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PHP Server Monitor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with PHP Server Monitor. If not, see https://www.gnu.org/licenses/.

Docker

PHPServerMonitor is now available on Docker : https://github.com/phpservermon/docker-phpservermonitor

phpservermon's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpservermon's Issues

Check for certain string on website

The current system only checks the HTTP status code for websites. A feature requested multiple times is to be able to provide a string to search for on the website and use that to determine whether the site is actually up.

For example, if there is an error page or database error and the HTTP status code is not properly set, you would still be able to add a proper check for that.

jqPlot reference

jqPlot is under GPL or MIT licenses (you can choose the license you prefer).
I think you should add a reference, a link, something, to indicate jqPlot is used.

Add permission denied error page

Currently the Router class will simple die() with a 'Permission denied' error if the user is not authorized to execute the module / action. Replace the die() with a proper error page informing the user.

Add smsit.dk to SMS

Hi

Could you add smsit.dk as an sms service ? they already have an easy API

****** GOOGLE translate ********

This site is intended for developers or programmers. It will explain how you can send SMS from your own system through smsit.dk's system.

Sending SMS messages via API
You can use the following URL to send an SMS through smsit.dk's API:

http://www.smsit.dk/api/sendSms.php?apiKey=[KEY]&senderId=[SENDER]&mobile=[PHONENUMBER]&message=[MSG]
NOTE: The mobile number must be the prefix of the Danish country code which is 45 If for example you want to send an sms to 22334455, then you must complete [mobile number] with 4522334455

Return codes

When the above URL is called it will return one of the following return codes:

Code Meaning
0 Everything went as it should!
1 Invalid API key
2 Invalid sender name
3 Invalid character set (charset)
4 Invalid mobile number
5 There is not filled out a message
6 The message is too long
7 API-key does not exist
All parameters for sending SMS

Parameter Delimitation Default
apikey 16 characters No
senderid Max 11 characters No
mobile 10 characters No
message Max 6 concatenated messages (918 characters) No
charset Must be either ISO-8859-1 or UTF-8 UTF-8
Safety
Your API key is identifying yourself to the smsit.dk. This means that you should treat it as you do with any important password.

Feature request: be able to filter out phpservermon in Web analytics

Hi!
First of all, thank you for phpservermon: it's a great tool that, as is, provides a lot of peace of mind knowing that if any of my customers website is down, I'll be the first to know °-)

Here is my suggestion: I suppose that every time the cron runs and the ping is done to the configured web services, it gets logged by the web system analytics (Google Web analytics in my case) as a unique visitor. If this is correct, would it be possible to specify an http header identifying phpservermon and so, filter it out from the traffic analytics reports?

Thank you for your time considering this suggestion.

Bad link to servers

When a server is configured without prefix (http://), everything works but the link to the server on Servers page redirect to the phpservermon server.
http:// should be prepended to the link if it doesn't already.

Database error handling

Install.php sets all fields in the servers table to NOT NULL, and provides no default value, so when a new server is added the database throws and error for the fields error, rtime, last_online and last_check. [Also there is no error reporting for database errors, which I will log separately, so the web interface falsely says "server added".] I changed my database to allow nulls in these 4 fields and everything works smoothly now.

Set number of failures before triggering the alarms

An option to only send email/text alerts once there have been a certain number of connection failures, i.e.:

first failure – logged, but no email/sms sent yet – status could be “yellow” as opposed to red/green.
second failure – email/sms triggered.

Archive uptime records after a month

The current uptime table keeps a record for every check for every server that has been made. This will cause the uptime table to grow really large, while not all data may be relevant.
Instead, archive old records from the uptime table in a different table to save space. In the archive table we could keep 1 row for each day, which would include averages of all checks made that day.
With the archive table we can still show relevant history (min/avg/max latency, number of failed checks (for uptime statistics as well) etc), but we don't require so many records.

This is a different solution for #38 which would delete all old data instead.

Main page

Perhaps it would be a good idea to make the main "servers" page the page that is currently called "status", because it provide a better interface for viewing whether servers are online or offline. The "servers" page is more ideal for editing and adding servers.

Port 3389 Doesn't work

I tried adding some windows based servers and usually port 3389 ( RDP port ) is the only port which is open but the script doesn't work with port 3389 it will give the connection refused error. I Tried to check if the server port is open from http://www.yougetsignal.com/tools/open-ports/ and it shows that the server port is open.

Title

I suggest that the title not be translated.
Today, it is translate in some languages and not in others.
I think the title could be the name of the application: Server Monitor, PHP Server Monitor, PHPServerMonitor or phpServerMonitor

Follow HTTP Location header

The cURL requests for website do not follow HTTP Location headers, so if you have a redirect from HTTP to HTTPS it will not follow and the website might be marked offline. Especially for the regex search it is necessary to follow the location header.

class.phpmailer.php don`t send mail correctly 3.0.1/3.1.0

After installing the lastest 3.0.1 or 3.1.0-dev version of phpservermon on shared hosting account - the script not send emails on server status changed, offline or always.

Cronjob ouput:
/usr/sbin/sendmail: unexpected response 555 to RCPT TO command
/usr/sbin/sendmail: unexpected response 554 to DATA command

With version 2.1.0 version this problem doesnt exist.

Test mail/SMS settings

There is no way to test the mail and SMS settings, so you have to add a fake server and run the live updater for testing purposes.
Add a feature to the config page to test the provided settings to make sure they work.

Different design styles on status page

Hi

it would be nice if you could have an list view on the overview site, I made one on my server but would be nice if it was included.

maybe make en option for each user.

<!--%tpl_server_status-->
<style type="text/css">
    body {
        background: black;
    }

    .page-header {
        border-bottom: 0;
    }

    h2, p {
        margin: 0;
        padding: 0;
    }

    h2 {
        margin-bottom: 10px;
    }

    table {
        border-collapse:collapse;
    }

    td{
        font-size:1.8em;
    }

    .offline, .online {
        display:table-row;
    }
    .entity {
        text-align: left;
        padding: 10px;
        cursor: pointer;
        box-shadow: none;
        margin:0;
        border:none;
        border-radius:0;
        display:table-cell;
    }

    .table tbody tr:hover td, .table tbody tr:hover th {
        background-color: #eee !important;
        color: #000;
    }

    .offline .entity {
        background-color: #d9534f; 
        color: #f7cece;
        border:none;
        border-left: 1px solid #dddddd;
        border-top: 1px solid #dddddd;
    }
    .offline .entity.warning {
        background-color: #f0ad4e;
        color: #F3F3B1;
        border:none;
        border-left: 1px solid #dddddd;
        border-top: 1px solid #dddddd;
    }
    .online .entity {
        background-color: #5cb85c;
        color: #d8f7ce;
        border:none;
        border-left: 1px solid #dddddd;
        border-top: 1px solid #dddddd;
    } 
</style>
<div class="entity-container">
    <table class="table table-bordered">
        <thead>
            <tr style="background: grey;">
                <th>Name</th>
                <th>Last online</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            <!--%tpl_repeat_servers_offline-->
                <tr class="offline" onclick="window.location.href='{url_view}'">
                    <td class="entity {class_warning}">{label}</td>
                    <td class="entity {class_warning}">{label_last_online}: {last_online_nice}</td>
                    <td class="entity {class_warning}">{label_last_check}: {last_checked_nice}</td>
                </tr>
            <!--%%tpl_repeat_servers_offline--> 
            {servers_offline}
            <!--%tpl_repeat_servers_online-->
                <tr class="online" onclick="window.location.href='{url_view}'">
                    <td class="entity">{label}</td>
                    <td class="entity">{label_last_online}: {last_online_nice}</td>
                    <td class="entity">{label_rtime}: {rtime}s</td>
                </tr>
            <!--%%tpl_repeat_servers_online-->
            {servers_online}
        </tbody>
    </table>
</div>
<!--%%tpl_server_status-->

status board

Can't delete user

In 2.2, I can't delete user.

When I click on the delete button, I am redirected to this url :
/index.php?action=delete&id=3&type=user

which displays the same informations as server_status without deleting the user.

I activated PSN_DEBUG but no particular error is shown.

I'm using Debian Wheezy, PHP 5.5.10, Apache 2.2.22, MySQL 5.5.35

Still down notifications

I think it would be a good idea to have "still down" notifications in addition to the existing "down" and "back up" notifications. These could be optional.

Notification setting improvements

Now that I've experienced my first server outage, I better understand my needs and, by extension, the needs of people I know, were they using this software.
There would be great value in being able to set different Notification Settings for the Log, e-mail and Text Messaging. For example, the first thing I did after getting up this morning and finding DOWN and UP e-mails 13 minutes apart, was to check the Log, knowing I have a 5 minute test interval. Once I answered my first question, I found my second question unanswered: "given that the first test yielded a timeout, what did the second and third test return as an error?"
Yes, I could set Notification to Always, but I purposely chose "Status change" to avoid the possibility of flooding myself and the administrator of the web site being tested, with countless e-mails given a long outage. That could even trigger a spam filter. I also realize that, had I used text messaging, there is a significant cost in that decision since I pay by the number of messages received.
Taking the concept two steps further, into less important improvements, setting Notification Settings on a per server and per user basis would also be useful. For example, the technical person might want different Notification Settings for himself and production servers/web sites than for a manager or user and test servers or less important web sites.
Finally, I realize that a completely new Notification Setting would go a long way to solve my initial concern: Status Change + any change in reason, for example, two timeouts followed by three 404 followed by another five timeouts before the site goes back on-line, would give me 4 e-mails and log entries. Extremely helpful for diagnosis and/or talking to Support folks.

User Login Fails

All notices pointed to a successful upgrade. I then chose user/pword, but when I tried to login it gave me incorrect password. So I reset it. Three times. And I still can't get in.

Please advise.

bootstrap-responsive

You included bootstrap-responsive.css but you added it before style.css
The problem is, with bootstrap-responsive, navbar-fixed-top style pass from position:fixed to position:static if width is under 980px.
As you set padding-top:70px; in style.css, the navbar appears 70px under the top.
The solution is to include bootstrap-responsive.css after style.css because it reset padding-top if width is under 980px, or set navbar-fixed-top as fixed in style.css (I know that latest versions of Safari for iOS works better with fixed attributes than before).

setlocale depends on the server environment

the php function setlocale doesn't always accept the same parameter
example:
for France, on linux (and Mac) the parameters must be
setlocale(LC_TIME, 'fr_FR');
or
setlocale(LC_TIME, 'fr_FR.UTF-8');
on windows (WAMP), the parameters must be
setlocale(LC_TIME, 'french");
according to http://msdn.microsoft.com/en-US/library/39cwe7zf%28v=vs.80%29.aspx

As setlocale accept several locales, we could change the code to something like
setlocale(LC_TIME, $locale, $locale . '.UTF-8', $sm_lang['locale']);
with 'locale' => 'french' in fr_Fr.lang.php

This let the possibility to the server administrator to change the locale string depending of the environment.

Add validation to servers page

No validation is currently implemented on the server page, so you can add servers without label, ip etc, which doesn't make any sense.

Add option to ping servers

The current service functionality is only able to check whether a service is listening on a certain port. If you just want to ping a server without a specific port and check for response yes/no, this is not possible. A situation where a ping could be useful is for checking dyndns hostnames.
Because it is a different protocol it can not be checked with the current fsockopen(). The suggestion is to use port no. 1 for pings. So if a service is added with port=1, no fsockopen() will be used but instead an exec() to execute the ping program.

Keep server history for statistics

Keep a record of uptime statistics for all servers during each check, including response time and up/down status, so statistics can be generated per server with a history view of when it was down, how long it was down etc.

Required data:

  • Date
  • Uptime (status)
  • Latency
  • ..?

XSS filtering

Full report here: http://cxsecurity.com/issue/WLB-2012110152
Vulnerability: Stored XSS
Label name or pretty much any other text field such as IP
Inserting html code can pretty much screw up the whole page as well.

PoC:

<script>alert('xss');</script> <script>alert(document.cookie);</script> <iframe>something</iframe>

Server Name Ordering

On "SERVERS" page, list of servers is shown A-Z.

However on "USERS", and when editing a user, ordering isn't A-Z (Might be order of entry?)

Install with MySQL strict mode does not work

If strict mode is enabled in MySQL several queries (adding default servers, but more importantly, adding the first user) give an error because not all fields are inserted (ie password) while it has no default value in mysql.

User authentication

Implement user authentication using the existing user table. Email field will be required, new username and password fields will be introduced and an extra step will be added to the install module to set up an initial account.

Add uptime percentage for past week

The server info shows graphs including when it was down, but it does not give any percentages on downtime.
While the accuracy of a calculated percentage would entirely depend on the interval of the checks, for the last week a percentage could be calculated quite easily (we have timestamps so can calculate the number of seconds a server was down).
For archived records we hold only 1 record per day with averages, making it hard to calculate accurate percentages from that data. An option could be to calculate daily percentages when archiving and adding that to the history. Using the number of checks and number of checks failed is not reliable because the user could have pressed the update button multiple times in a short period for testing purposes.

Feature Request

Great work. would be nice to see a % of uptime, and when the server went off line last.

cheers
andy

No notification on server down/change

I just installed your monitor & think it's great. Easy to use and I love the email & SMS options.

However, in testing bringing a server down, the UI shows the server is down, but no email or SMS notification is sent, nor is there a log of either. Am I missing something?

Header location after logout and login again

capture

After loggin and logout the script add one "/" in the end of URL address (for example domain dot com//. After that if I try to loggin and press "Log In" the script redirect me to loggin page, not to status. After click "Log In" again all done and recirect me to server status page.

Charts

I could add a new menu to display graphically the response time and availability of all servers for the last month/week/day/hour.

I can implement it using the jqPlot jQuery plugin. It is powerfull, and free (GPL and MIT license)

Warning threshold ignored for notification trigger

The warning threshold has been added to set a server in "warning" state until the threshold has been met, to avoid too many errors and notifications when you have an unstable connection for example.

The threshold works fine with the status of the server, it puts it in warning state. However, it will send notifications immediately once a server goes down, regardless of the warning threshold. So the updater has to be fixed to obey the threshold before sending notifications.

Translate database direct output

I noticed that there are some items like yes, no, website, service (on the server page) that are not translated. This because it is direct database output. I've looked at the project and came up with a couple solutions;

  • concat in MySQL CONCAT('{label_', email, '}') AS email
  • Edit string in for loop $servers[$x]['email'] = "{label_".$servers[$x]['email']."}"
  • Handling the translation in the template with something like {label_{email}} (I think this only works in tpl_repeat blocks because the template is parsed twice)
  • Translate with something like $servers[$x]['email'] = $this->translate($servers[$x]['email']);
  • Modify Template.class.php with a specific translation tag that is run just before outputing the html.

Maybe you have a better solution :D

Tell me what you prefer and I will take a look at changing it and create a pull request

container-fluid

To use row-fluid, the container must have class="container-fluid" and not class="container"

Option to make status page public

Several users have expressed the wish to make the status page available to the public so it can be embedded on a website.
This would require a toggle in the configuration to enable the public page, and maybe even per-server settings to determine which servers to make public.

Add user selection to server edit page

In the current setup you need to edit each user individually to add a server. So if you have just added a new server and you want all users to have access to it, you need to edit all of them separately.
If we add a multi-select with users to the edit-server page you can also easily select users for that server in one go.

2.2 : Status.cron.php error when date.timezone is not set

Status.cron.php returns the following error when date.timezone is not set in php.ini (for CLI) :

PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in /var/www/default/phpservermon/src/psm/Util/Updater/Autorun.class.php:83
Stack trace:
#0 /var/www/default/phpservermon/src/psm/Util/Updater/Autorun.class.php(83): DateTime->__construct()
#1 /var/www/default/phpservermon/cron/status.cron.php(48): psm\Util\Updater\Autorun->run()
#2 {main}

thrown in /var/www/default/phpservermon/src/psm/Util/Updater/Autorun.class.php on line 83

This behaviour was not present in 2.1.
Setting the correct timezone in php.ini solves the problem.

I'm using Debian Wheezy, PHP 5.5.10, Apache 2.2.22, MySQL 5.5.35

Status updater can run multiple times

The status updater does not check whether there is already a copy running. If the script has been added as a cronjob, it could run multiple times causing duplicate notifications. To avoid this, we can add a "cron running" flag to the config table. The only consideration is, what happens if the cronjob dies for an unspecified reason? The "cron running" flag will still be set, keeping a new job from starting.
One possibility is to add a timestamp as well and set a certain interval after which the cronjob is supposed to have died. Once the interval has been reached, the cron will run anyway and reset the flag.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.