Warning on site down - Any best practice?

One of my websites, online and stable for 2 month, went down today. It was a cache problem bringing a “Crikey!” error. Client called me…
I would like to be warned by email if such arrive again (server down or “Crikey!”).

What are the best practice you are using ?
Is it with Cpanel ? With services like pingdom.com / uptimerobot.com ? Within Grav ?

If an error page “Crikey!” happens, will it be considered as a site down situation ?

By the way, the error I got was this:

33 RocketTheme\Toolbox\File\PhpFile decode
34 Parse error*
…/vendor/rockettheme/toolbox/File/src/File.php300
/home/okcbncoc/public_html/cache/compiled/files/186b0fd34fbb963e850444b975b1ece4.yaml.php
342 ‘LANGUAGES’ => ‘Sprog’,
343 ‘SUPPORTED’ => ‘Understøttet’,
344 ‘SUPPORTED_HELP’ => 'Kommasepareret liste af sprogkoder på hver to
Arguments
“syntax error, unexpected '‘Kommasepareret liste af sprog’ (T_ENCAPSED_AND_WHITESPACE)”

I just went in Terminal, deleted cache and all went back normal.
Is that a bug that I should report?
Seems to be linked to a Danish language da.yaml file of Grav Admin plugin.

Thank you.

Hi @red

We use Pingdom for that sort of thing - you can configure a site availability test to check for specific content so for example

‘Alert me when the site has page content of ‘Crikey’’
or
‘Alert me if the homepage does not contain ‘ACME Corp’’

It’s not cheap - but we use it across all of our projects - so worthwhile…

Andrew

1 Like

Thank you @parkersweb for feedback. I’ll dig further on this.

I have the same error a few days ago when I was still developing the site on my local environment. It appeared on every pages including the admin panel.

I have been using uptimerobot.com which is helpful. They have a free version which checks the websites every 5 minutes. This allows me to be informed before client when a site is down… & act accordingly.

My problem referred to on my first post is still not solved. It happens on 2 twin production websites more frequently recently.
The 2 websites, both multi-lingual, will be OK for several days, then down with various errors. I tried to clean up things here and there (had problems with ’ and ’ in frontmatter and this is sorted). I fixed permissions. I am all green in ‘Grav Potential Problems’ of the admin, I looked at previous messages on the subject, and on learn.getgrav.org (I do not master all).

How should I trace back the problem?
How can I validate it without having to wait for the next occurrence of the problem?

Hopefully, answers will help others in a similar situation.

Here are the logs of recent events, limited to the first 5 lines:

[2020-08-12 13:16:59] grav.CRITICAL: Template “grid.html.twig” is not defined. - Trace:
#0 /home/okcbncoc/public_html/system/src/Grav/Common/Service/OutputServiceProvider.php(28): Grav\Common\Twig\Twig->processSite(‘html’)
#1 /home/okcbncoc/public_html/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\OutputServiceProvider->Grav\Common\Service{closure}(Object(Grav\Common\Grav))
#2 /home/okcbncoc/public_html/system/src/Grav/Common/Processors/RenderProcessor.php(28): Pimple\Container->offsetGet(‘output’)
#3 /home/okcbncoc/public_html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\RenderProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler))
#4 /home/okcbncoc/public_html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest))
#5 /home/okcbncoc/public_html/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php(28): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest))

[2020-08-16 20:50:51] grav.CRITICAL: The header string should not be empty. - Trace:
#0 /home/okcbncoc/public_html/system/src/Grav/Common/Page/Page.php(1416): Negotiation\AbstractNegotiator->getBest(’’, Array)
#1 /home/okcbncoc/public_html/system/src/Grav/Common/Service/OutputServiceProvider.php(28): Grav\Common\Page\Page->templateFormat()
#2 /home/okcbncoc/public_html/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\OutputServiceProvider->Grav\Common\Service{closure}(Object(Grav\Common\Grav))
#3 /home/okcbncoc/public_html/system/src/Grav/Common/Processors/RenderProcessor.php(28): Pimple\Container->offsetGet(‘output’)
#4 /home/okcbncoc/public_html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\RenderProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler))
#5 /home/okcbncoc/public_html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest))

[2020-08-19 17:14:31] grav.CRITICAL: The header string should not be empty. - Trace:
#0 /home/okcbncoc/public_html/system/src/Grav/Common/Page/Page.php(1416): Negotiation\AbstractNegotiator->getBest(’’, Array)
#1 /home/okcbncoc/public_html/system/src/Grav/Common/Service/OutputServiceProvider.php(28): Grav\Common\Page\Page->templateFormat()
#2 /home/okcbncoc/public_html/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\OutputServiceProvider->Grav\Common\Service{closure}(Object(Grav\Common\Grav))
#3 /home/okcbncoc/public_html/system/src/Grav/Common/Processors/RenderProcessor.php(28): Pimple\Container->offsetGet(‘output’)
#4 /home/okcbncoc/public_html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(45): Grav\Common\Processors\RenderProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler))
#5 /home/okcbncoc/public_html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(57): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest))

[2020-08-21 19:21:12] grav.CRITICAL: syntax error, unexpected end of file, expecting ‘]’ - Trace:
#0 /home/okcbncoc/public_html/system/src/Grav/Common/Config/CompiledBase.php(116): Grav\Common\Config\CompiledBase->loadCompiledFile(’/home/okcbncoc/…’)
#1 /home/okcbncoc/public_html/system/src/Grav/Common/Service/ConfigServiceProvider.php(137): Grav\Common\Config\CompiledBase->load()
#2 /home/okcbncoc/public_html/system/src/Grav/Common/Service/ConfigServiceProvider.php(51): Grav\Common\Service\ConfigServiceProvider::languages(Object(Grav\Common\Grav))
#3 /home/okcbncoc/public_html/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\ConfigServiceProvider->Grav\Common\Service{closure}(Object(Grav\Common\Grav))
#4 /home/okcbncoc/public_html/system/src/Grav/Common/Themes.php(307): Pimple\Container->offsetGet(‘languages’)
#5 /home/okcbncoc/public_html/system/src/Grav/Common/Themes.php(278): Grav\Common\Themes->loadLanguages(Object(Grav\Common\Config\Config))

[2020-08-30 10:27:43] grav.CRITICAL: syntax error, unexpected ‘’—’ (T_ENCAPSED_AND_WHITESPACE) - Trace:
#0 /home/okcbncoc/public_html/system/src/Grav/Common/Config/CompiledBase.php(116): Grav\Common\Config\CompiledBase->loadCompiledFile(’/home/okcbncoc/…’)
#1 /home/okcbncoc/public_html/system/src/Grav/Common/Service/ConfigServiceProvider.php(137): Grav\Common\Config\CompiledBase->load()
#2 /home/okcbncoc/public_html/system/src/Grav/Common/Service/ConfigServiceProvider.php(51): Grav\Common\Service\ConfigServiceProvider::languages(Object(Grav\Common\Grav))
#3 /home/okcbncoc/public_html/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\ConfigServiceProvider->Grav\Common\Service{closure}(Object(Grav\Common\Grav))
#4 /home/okcbncoc/public_html/system/src/Grav/Common/Themes.php(307): Pimple\Container->offsetGet(‘languages’)
#5 /home/okcbncoc/public_html/system/src/Grav/Common/Themes.php(278): Grav\Common\Themes->loadLanguages(Object(Grav\Common\Config\Config))

[2020-09-02 12:08:08] grav.CRITICAL: syntax error, unexpected ‘‘Il tipo di pagina che si trad’ (T_ENCAPSED_AND_WHITESPACE) - Trace:
#0 /home/okcbncoc/public_html/system/src/Grav/Common/Config/CompiledBase.php(116): Grav\Common\Config\CompiledBase->loadCompiledFile(’/home/okcbncoc/…’)
#1 /home/okcbncoc/public_html/system/src/Grav/Common/Service/ConfigServiceProvider.php(137): Grav\Common\Config\CompiledBase->load()
#2 /home/okcbncoc/public_html/system/src/Grav/Common/Service/ConfigServiceProvider.php(51): Grav\Common\Service\ConfigServiceProvider::languages(Object(Grav\Common\Grav))
#3 /home/okcbncoc/public_html/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\ConfigServiceProvider->Grav\Common\Service{closure}(Object(Grav\Common\Grav))
#4 /home/okcbncoc/public_html/system/src/Grav/Common/Themes.php(307): Pimple\Container->offsetGet(‘languages’)
#5 /home/okcbncoc/public_html/system/src/Grav/Common/Themes.php(278): Grav\Common\Themes->loadLanguages(Object(Grav\Common\Config\Config))

Thank you for help.

If someone cores around here, I am still interested in suggestions…

Hi I’m no expert on these grav errors but it looks like the problem areas are all in the first line of your errors, so I would start with investigating those bits of your templates. They look like mostly typo or blank field type issues. Maybe there’s some syntax issues with some of your twig commands causing them to not find any data.

I have been wanting a simple script that could check my grav sites every time I make a change. With the help of a gist this morning, I put this together:

#!/usr/bin/env bash

# from: https://gist.github.com/pix0r/6083058
function crawl_sitemap() {

  SITEMAP=$1

  if [ "$SITEMAP" = "" ]; then
    echo "Usage: $0 http://domain.com/sitemap"
  else
    XML=`wget -O - --quiet $SITEMAP`
    mapfile -t URLS < <(echo $XML | \
      grep -o "<loc>[^<>]*</loc>" | \
      sed -e 's:</*loc>::g' | \
      tr ' ' '\n' )
    for url in ${URLS[@]}
    do
      echo url: $url
      page=`wget -O - --quiet --random-wait -nv $url`
      wgetreturn=$?
      if [[ $wgetreturn -ne 0 ]]; then
        echo ERROR: $wgetreturn
        # wget error codes
        # https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html
        case $wgetreturn in
          8 )
            echo "     Server issued an error response"
            # inspect $page for error codes
            ;;
        esac
      fi
    done
  fi

}

there is a lot to say here (and improve). The grep and sed filter is inherited from the original and can be simplified. I will probably use xmlstarlet for grabbing the locations from the sitemap and the error details from the page content.

  • Φ

OK, thank you for your feedback. I’ll go through all templates once more.
For the past few month, I have relied on uptimerobot to inform me when those sites are down, then I would immediately clear cache and all will be fine for a few days/weeks.

As for @phi’s comment, I am afraid it is too high level for my skills. Not sure how to make use of it… :flushed:

I’ll report here if I find the problem(s).