# Meet Statusimo – PowerShell generated Status Page

Meet Statusimo, a PowerShell-generated status page for tracking service health and publishing a simple internal or public status view.

blog

06 Mar 2019 es

![Meet Statusimo – PowerShell generated Status Page](/wp-content/uploads/2019/03/img_5c7feee0d161a.png)

[Ver imágenes (6)](#pf-content-image-1-0)

A few weeks ago, [Mateusz Czerniawski](https://twitter.com/Arcontar), mentioned that he wants to build a **Status Page** for his company services. While I haven't needed for myself, it seems like an excellent idea to try and create one in **PowerShell**. Since I've been working on **PSWriteHTML** for a while, it wasn't that far fetched idea. While **PSWriteHTML** has a long way to go, to be in a state I want it to be, after a few days I had a **prototype** that didn't require much work to generate. If you're wondering what Status Page is it's a little summary page for your users to check what is the status of services they use. It has been popular in the last few years and is offered by many services (**Twitter**, **GitHub**, **Office 365** – they all have it). Companies are selling it** as a service** as well where you can host your status page for your users. This one is free.

### 💡 Statusimo – What you get?

While I am reasonably sure that you understood the idea behind it, it's best to show you what you get before going into details on how to get there. What you see below is Statusimo Page. It's a **single HTML** file that you can host however you like.

> What you hear, you forget; what you see, you remember; what you do, you understand.

[!\[Statusimo\](/wp-content/uploads/2019/03/img_5c7f91eebd783.png)](/wp-content/uploads/2019/03/img_5c7f91eebd783.png)

Looks nice? Are you interested? No? Oh, well, feel free to explore my **[other PowerShell modules](https://evotec.xyz/sixteen-powershell-modules-that-ive-worked-on-in-2018/)** which may be more to your likening. For those that things above look interesting, let's continue, shall we? All the above visual part is generated by a single PowerShell function.

```powershell
Import-Module Statusimo # it may not be necessary if you've it installed on a system

New-StatusimoPage -FilePath $PSScriptRoot\StatusPage.html -IncidentsPath $PSScriptRoot\Incident -MaintenancePath $PSScriptRoot\Maintenance
```

Function **New-StatusimoPage** takes three parameters. One is a path to where to save generated **HTML** file, and the other two are where all the incidents and maintenance are stored. You see, the way it's designed is that generation of the page is based on incidents. Each event is a simple JSON structured file. This function scanned the folder with all events and based on that data generates output. If there is no data or path is wrong output would look like below.

[!\[Statusimo Empty Page\](/wp-content/uploads/2019/03/img_5c7fa64a73eb6.png)](/wp-content/uploads/2019/03/img_5c7fa64a73eb6.png)

It's not pretty, but this is just a starter when there's nothing in it. There are no files in the Incident or Maintenance folder, so there's no way for this module to generate any data. Let's add some then.

[!\[Statusimo\](/wp-content/uploads/2019/03/img_5c7feee0d161a.png)](/wp-content/uploads/2019/03/img_5c7feee0d161a.png)

### 💡 Statusimo – Adding incidents / events

There are two ways to add incidents. Create JSON file in Incidents folder or use PowerShell command.

```powershell
Import-Module Statusimo

$newStatusimoIncidentSplat = @{
    Date       = (Get-Date)
    Overview   = "We're currently experiencing issues. No services are available."
    Title      = 'Exchange Servers are Down'
    Status     = 'Down'
    Service    = 'Exchange'
    FolderPath = "$PSScriptRoot\Incidents"
}
New-StatusimoEvent @newStatusimoIncidentSplat

$newStatusimoIncidentSplat = @{
    Date = (Get-Date)
    Overview = "We're currently experiencing issues with Active Directory. It may work slower then usual."
    Title = 'Active Directory controller is down'
    Status = 'Partial Degradation'
    Service = 'Active Directory'
    FolderPath = "$PSScriptRoot\Incidents"
}
New-StatusimoEvent @newStatusimoIncidentSplat

New-StatusimoEvent -FolderPath $PSScriptRoot\Incidents -Date (Get-Date) -Service 'Hyper-V' -Status 'Operational' -Title 'Hyper-V OK' -Overview "Cluster is fully functional now"
```

As you can notice above there are three events created. You have five important parameters. **Date**, **Overview**, **Title**, **Status, **and **Service**. Of course, there's the **6th** parameter where to store the event but that's not that important at the moment.

- 🌐 **ServiceName** – What's important to know is that when you write a service name, it can be anything you want (with reasonable limits). If it's the first event with **Service Name**, it will create a new status for it under the **Current Status** section. If it's second or later event, it will just update the status. If you will make a typo and have Active Directory and ActiveDirectory in two different events it will create two services. Being consistent is important.

[!\[Statusimo current status section showing several services by name\](/wp-content/uploads/2019/03/img_5c7fc0363bea5.png)](/wp-content/uploads/2019/03/img_5c7fc0363bea5.png)

- 🌐 **Status** – There are three statuses **Down (color Red)**, **Partial Degradation (color Orange)** and **Operational (color Green)**. When the system generates HTML it takes the newest event and checks status of it and changes Current status accordingly.
- 🌐 **Title **– Title is displayed in incidents status

[!\[Statusimo incidents list showing incident titles and statuses\](/wp-content/uploads/2019/03/img_5c7fc47932c38.png)](/wp-content/uploads/2019/03/img_5c7fc47932c38.png)

- 🌐 **Overview **– this section is a longer description of what is happening.
- 🌐 **Date **– this is a date for the event, incident to happen. Sorting is applied based on it.

When you execute **PowerShell** above each entry creates a single **JSON** file with a structure like below

```json
{
    "Date":  "\/Date(1551889816096)\/",
    "Service":  "Exchange",
    "Status":  "Down",
    "Title":  "Exchange Servers are Down",
    "Overview":  "We\u0027re currently experiencing issues. No services are available."
}
```

It means you're free to create those JSON files yourself via any means, or external applications and as long as you will keep it's the format you can feed data directly into **Statusimo**.

### 💡 Statusimo – Adding maintenance

There are two ways to create maintenance. Add specially crafted JSON file (it's simple enough) generated by some of your systems, by your Service Desk agent or run this little **PowerShell** command. Below code adds 3 types of maintenance types. One that is planned, one that is already in progress and one that is already done. It's strictly based on **DateStart** and **DateEnd** parameters. There's no need to modify maintenance when there is time to start maintenance.

```powershell
Import-Module Statusimo

$newStatusimoMaintenanceSplat = @{
    Title = 'Hyper-V scheduled maintenance'
    DateStart = (Get-Date).AddDays(5)
    DateEnd = (Get-Date).AddDays(6).AddHours(2)
    Service = 'Hyper-V'
    Overview = "Updating core infrastructure for Hyper-V. Servers may be affected."
    FolderPath = "$PSScriptRoot\Maintenance"
}

New-StatusimoMaintenance @newStatusimoMaintenanceSplat


$newStatusimoMaintenanceSplat = @{
    Title = 'Hyper-V scheduled maintenance'
    DateStart = (Get-Date).AddDays(-1)
    DateEnd = (Get-Date).AddDays(2).AddHours(2)
    Service = 'Hyper-V'
    Overview = "We will be changing HDD in ClusterX"
    FolderPath = "$PSScriptRoot\Maintenance"
}

New-StatusimoMaintenance @newStatusimoMaintenanceSplat


$newStatusimoMaintenanceSplat = @{
    Title = 'Hyper-V scheduled maintenance'
    DateStart = (Get-Date).AddDays(-1)
    DateEnd = (Get-Date).AddDays(-1).AddHours(2)
    Service = 'Hyper-V'
    Overview = "Small cable replacement"
    FolderPath = "$PSScriptRoot\Maintenance"
}

New-StatusimoMaintenance @newStatusimoMaintenanceSplat
```

[!\[Statusimo maintenance section showing a planned maintenance window\](/wp-content/uploads/2019/03/img_5c7ff2510d29d.png)](/wp-content/uploads/2019/03/img_5c7ff2510d29d.png)

Maintenance is solely based on DateStart and DateEnd. Maintenance will switch itself when the time is right from planning to progress to over, but only upon page regeneration.

```powershell
Import-Module Statusimo

New-StatusimoPage -FilePath $PSScriptRoot\StatusPage.html -IncidentsPath $PSScriptRoot\Incidents -MaintenancePath $PSScriptRoot\Maintenance
```

The idea here is that page regeneration should be** triggered automatically** so one doesn't have to do it manually. There are many ways to achieve it – **Task Scheduler**, **Folder monitoring**, and **others**.

### 💡 Statusimo – Removing maintenance

There are two ways to remove maintenance. Simply delete files from **Maintenance** folder and generate a new page or run PowerShell command that will delete any maintenance works based on how old **DateEnd** will be.

```powershell
Import-Module Statusimo

Remove-StatusimoMaintenance -DaysOld 0 -MaintenancePath $PSScriptRoot\Maintenance
New-StatusimoPage -FilePath $PSScriptRoot\StatusPage.html -IncidentsPath $PSScriptRoot\Incidents -MaintenancePath $PSScriptRoot\Maintenance
```

Basic module description and module page is located at [**Statusimo – PowerShell Module**](https://evotec.xyz/hub/scripts/statusimo-powershell-module/).

## Proyectos relacionados

Proyectos que encajan con las etiquetas, categorías y contenido de este artículo.

[Todos los proyectos](/es/proyectos/)

Buscando proyectos relacionados...

[Volver al blog](/blog)

## Artículos relacionados

- [Meet Dashimo – PowerShell Generated Dashboard](/es/blog/meet-dashimo-powershell-generated-dashboard/)
- [Solving typo problems with Fuzzy Search in PSWriteHTML](/es/blog/solving-typo-problems-with-fuzzy-search-in-pswritehtml/)
- [Advanced HTML reporting using PowerShell](/es/blog/advanced-html-reporting-using-powershell/)

<!-- PowerForge markdown artifact sha256:2E7610204B48F58F204F7FBB840F7CFFFB5A69309E7EBBA6A8EAAA9BC6F0EF2C -->
