The power status of the server is detected on the string which returns is returned by the NOC-PS API. Depending on the device, the returned string can differ. If the power status of your server does not get detected correctly by the module, open the file you can extend the default values.
Please note the following things:
- All values must be lowercase, even if NOC-PS returns the value capitalized or uppercase.
- You should not directly edit the "OnlineOfflineStrings.php" file. This file will get overwritten on module upgrades.
- To view the default power values, please open the file "/modules/servers/dedicated/system/
...
- OnlineOfflineString.php
...
Info | ||
---|---|---|
| ||
All values must be lowercase. Even if the returned value is capitalized. |
The default file looks like this:
...
language | php |
---|---|
title | OnlineOfflineStrings.php |
linenumbers | true |
- ".
Add new power status values to the module
To extend the power values, follow this simple steps:
- Get the required value by opening the NOC-PS admin panel and click on IPMI → Status → Execute Command.
- A popup will appear with a message like "serverUP".
- Create or open the file "/modules/servers/dedicated/system/OnlineOfflineStrings.override.php" and add the value to the array found in the file OnlineOfflineString.php.
By making the changes in the override file, they are not reverted during a module update.
Exemplary Modification
...
If NOC-PS returns "serverUp" for online and "serverDown" for offline, edit the file accordingly. Note that the value has to be inserted lowercaseinsert the following value into the OnlineOfflineStrings.override.php file:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?php $OnlineStringArray[] = array('chassis power is on', 'on', 'online', 'running', 'serverup'); $OfflineStringArray[] = array('chassis power is off', 'off', 'offline', 'stopped', 'serverdown'); $ConnectionError = array('unable to establish'); |
The correct values can be checked at the NOC-PS admin panel:
- Open the NOC-PS admin page
- Select the server and click on IPMI
- Click on status → Execute command
As already mentioned, you must insert the value in lowercase.