Page 10 of 13

Re: Server Blog

Posted: Wed Apr 01, 2015 5:50 pm
by asavage
Margaritas!

Re: Server Blog

Posted: Wed Apr 01, 2015 5:52 pm
by plenzen
I'm in.

Re: Server Blog

Posted: Fri Apr 03, 2015 6:22 am
by goglio704
Al,

Thanks again for this forum. I have not been much of a participant the last few years, but it is nice to know the resource is out there.

I don't see the Paypal donate button anymore.

Is your email still the same?

Re: Server Blog

Posted: Fri Apr 03, 2015 7:26 am
by asavage
goglio704 wrote:Al,

Thanks again for this forum. I have not been much of a participant the last few years, but it is nice to know the resource is out there.
Too many of us invested too much of ourselves to not keep it around as a resource.
I don't see the Paypal donate button anymore.
Sumbitch. I wonder when that happened? I've gotta fix that ASAP.

So few donations rolled in that I never noticed the lack. Paul donated Feb2014, and I think that was the last one.
Is your email still the same?
Yup, since like 1993.

Re: Server Blog

Posted: Fri Apr 03, 2015 10:53 am
by asavage
Donate button for PayPal has been restored. It was knocked out by the forum software upgrade of 13Mar2015.

Re: Server Blog

Posted: Wed Jun 03, 2015 8:31 pm
by asavage
I lost another power supply today. I just happened to notice when walking by the server room that it seemed kinda quiet.

I had a spare power supply loose (and two complete spare identical computers sitting idle), so I grabbed the spare PS and installed it. The desktop is now at a resolution that my monitors find "out of range", but using VNC I can see that everything's running. I'll have to take the server down and fix that sometime, but for now we're up again.

I believe that's the third power supply failure we've had since this forum started in 2006.

Re: Server Blog

Posted: Thu Jun 04, 2015 1:09 pm
by plenzen
Thanks for performing CPR !

Or is it a transplant ??

Regardless
Thanks.

Re: Server Blog

Posted: Wed Jun 24, 2015 5:03 pm
by dieseldorf
Power supply failure may happen due to restricted airflow and over-heating. Dust collects inside and slowly disables the cooling effect of the fan. That happen to our servers at work also.

Re: Server Blog

Posted: Wed Jun 24, 2015 5:21 pm
by asavage
Not here.

I take every computer outside and blow it out with compressed air with the covers off, 2x per year.

The PS I removed had a fan I installed in it in 2011, much quieter than the OEM one and it was still spinning when the PS died. The PS was very clean inside, I took it all apart before I trashed it.

I have purchased another Corsair CX600 and will do the mod that I did on one of the other, identical boxes I use here at home. See this post for pics of the previous mod.

Cable modem rebooting

Posted: Fri Oct 16, 2015 3:23 pm
by asavage
A few weeks ago, I mentioned:
After a while, the inbound http requests do not make it to the server. It seems to be an issue with the ISP. Power-cycling the cable modem restores this.

I'm looking into implementing an automated power cycle on that modem. It's plugged into an APC MasterSwitch, and I need to look at that unit's management console to see if scheduled power cycling is an option.
I've put together and implemented a way to programmatically get the APC MasterSwitchPlus to power cycle the outlet into which the cable modem is plugged, and I've added the script as a cron job to execute at the same time as a scheduled reboot of the Apache web daemon httpd (ie at 0001 PST every morning).

It works from the commandline. Tomorrow, I will check to see if it worked as a scheduled job.

The single core line was copied -- thanks, apex!

For my own benefit, to refer to later, what I've done is listed below.

=================================

I was looking for more-or-less a one-liner, but things are often not as simple as they'd appear. I've around twelve hours into this.

I went with the php solution. To reboot the cable modem on outlet number 8, I call this script like this:

[f:\php5] php -c .\php.ini -f <path/to/script.php> 192.168.0.52 <password> 8 5

script.php:

Code: Select all

<?php
/* 
Created: 12Oct2015 ALS
Revised: 16Oct2015 ALS
PHP code to reboot an outlet on AP9225 w/AP9617 management card. Probably works OK with other NMCs such as AP9606, AP9618, AP9619.
Partly based around example code by apex at http://www.forked.net/forums/viewtopic.php?f=13&t=3490#p4131

Some documentation:

OID (Object ID) for MasterSwitch+ AP9225 = .1.3.6.1.4.1.318.1.1.6.5.1.1.5.1.1.

	Defining the first bits:
	1.3.6.1.4.1.318.1.1.6.5.1.1.5
	iso . org . dod . internet . private . enterprises . apc . products . hardware . masterswitchMSP . sPDUOutletControlMSP . sPDUOutletControlMSPTable . sPDUOutletControlMSPEntry . sPDUOutletControlMSPOutletCommand
	
	Getting this variable will return the outlet state. If the outlet is on, the immediateOnMSP (1) value will be returned. 
	If the outlet is off, the immediateOffMSP (3) value will be returned.

	Setting this variable to:
		immediateOnMSP (1) will immediately turn the outlet on.
		delayedOnMSP (2) will turn the outlet on after the sPDUOutletConfigMSPPowerOnDelay OID time has elapsed.
		immediateOffMSP (3) will immediately turn the outlet off.
		gracefulRebootMSP (4) will cause the outlet to wait for device confirmation 
			(if applicable) and then turn the outlet off after the sPDUOutletConfigMSPPowerOffDelay 
			OID time has elapsed.  The outlet will then turn on after the sPDUOutletConfigMSPRebootDuration OID time has elapsed.
		immediateRebootMSP (5) will immediately reboot the outlet.
		gracefulshutdownMSP (6) will cause the outlet to wait for device confirmation 
			(if applicable) and then turn the outlet off after the sPDUOutletConfigMSPPowerOffDelay OID time has elapsed.  
			The outlet will then turn on after the sum of the sPDUOutletConfigMSPRestartTime OID time and the 
			sPDUOutletConfigMSPPowerOnDelay OID time has elapsed.
		overrideBatCapThreshMSP (7) will cause the outlet to ignore the Battery Capacity Threshold 
			and proceed waiting on the sPDUOutletConfigMSPPowerOnDelay OID time before turning the outlet on.
		cancelPendingCommandMSP (8) will cause any pending command to this outlet to be cancelled.

 For now, I do not know what the trailing ".1.1." mean. 

 */

$oid = ".1.3.6.1.4.1.318.1.1.6.5.1.1.5.1.1." ; // AP9225
array_shift($argv); // Remove the first argument, which is always the script's name as called on the commandline.
echo "\r\n";  // Gain some separation from whatever may be on the screen.

if (empty($argv) || count($argv) != 4) {   // Check for the correct number of commandline arguments.
  echo "Incorrect number of arguments.\n";
  echo "Usage: MSP_Control IP password outlet action \r\n";
  echo "where:\r\n";
  echo "    IP       = IP address (eg 192.168.0.52) \r\n";
  echo "    password = password for a SNMP account in the AP9225 that has write authority\r\n";
  echo "    outlet   = integer that represents the outlet to be controlled (1..8)\r\n";
  echo "    action   = integer that represents the action to be performed: \r\n";
  echo "                1 = immediate power on          \r\n";
  echo "                2 = delayed   power on          \r\n";
  echo "                3 = immediate power off         \r\n";
  echo "                4 = graceful  reboot            \r\n";
  echo "                5 = immediate reboot            \r\n";
  echo "                6 = graceful  power off delayed \r\n";
  echo "                8 = cancel pending command      \r\n";
  
exit(1);   // End script; return a code for wrong arguments.
}

/* debug section
$host = "192.168.0.52" ;     // My test AP9225
$community = "private" ;     // Default password -- this should always be changed.
$outlet = "8" ;              // My cable modem is plugged into outlet #8.
$action = "5" ;              // 5 = reboot.

echo "var_dump after constants:\r\n";
echo var_dump($host, $community, $outlet, $action) . "\r\n";
*/

$host      = (string)$argv[0];
$community = (string)$argv[1];
$outlet    = (string)$argv[2];
$action    = (string)$argv[3];

// Input validation checks.  This should be enlarged/expanded/fleshed out if needed for robustness.
if ($outlet < 1 || $outlet > 8) {   // Test for valid outlet number.
	echo "Argument 'outlet' out of range.\r\n";
	echo "Must be an integer from this set: [1, 2, 3, 4, 5, 6, 7, 8].\r\n";
	exit(3);
}

$action_test = (int)$action;  // Cast to int to test using numeric comparisons.
if ($action_test < 1 || $action_test == 7 || $action_test > 8) {
	echo "Argument 'action' out of range.\r\n";
	echo "Must be an integer from this set: [1, 2, 3, 4, 5, 6, 8].\r\n";
	exit(4);
}

switch ($action) {                 // set up text for feedback later.
		case 1:
			$action_text = "immediate power on";
			break;
		case 2:
			$action_text = "delayed power on";
			break;
		case 3:
			$action_text = "immediate power off";
			break;
		case 4:
			$action_text = "graceful reboot";
			break;
		case 5:
			$action_text = "immediate reboot";
			break;
		case 6:
			$action_text = "graceful power off then delayed power on";
			break;
		case 8:
			$action_text = "cancel pending command";
			break;
}

$returncode = snmpset($host, $community, $oid.$outlet , "i", $action) ;

// debug section
// echo "returncode = " . $returncode . "\r\n";

if ($returncode) {
	echo "Succeeded: " . $action_text . " MasterSwitch+ outlet No. " . $outlet . ".\r\n";
	exit(0);
	}
else {
	echo "Failed: " . $action_text . " MasterSwitch+ outlet No. " . $outlet . ".\r\n";
	exit(2);
	}

?>

Re: Server Blog

Posted: Sat Oct 17, 2015 10:42 am
by asavage
Last night, the cable modem rebooted on schedule without issue. Just the way I like it!

Re: Server Blog

Posted: Tue Jan 26, 2016 7:00 pm
by asavage
Today, I found that though the cable modem is power cycled every night, the router stops forwarding requests (from the world, to the web server) every so often as well. Outbound continues to work fine, so it all "looks" fine here at home.

Since the script to power cycle outlets on the MasterSwitch+ is already written, I just added a line to reboot the router's power outlet too, at the same time as the modem.

Now, they're both get power cycled every night. Let's see if that helps.

Re: Server Blog

Posted: Wed Jan 27, 2016 6:55 pm
by plenzen
Question for you Al.
Today , on my phone, I Google searched "Nissan dyndns" as I always do and it displays the page with " discuss and cuss" etc.
Today however that link is not there when I search and the only way I seem to be able to get in is by clicking on a link sent with an auto reply to a topic I have been involved with.
Has the link to the site been removed from Google somehow ?
Thanks for keeping us alive.

Paul

Re: Server Blog

Posted: Wed Jan 27, 2016 7:13 pm
by asavage
I can't say. I almost never try using Google to find the site, and last time I looked, it came up on page two (which nobody reads). Now not even page three.

Nobody knows we're here :)

Re: Server Blog

Posted: Wed Jan 27, 2016 8:13 pm
by plenzen
Stealth mode !

Edit :

Well that's damned peculiar. I come home and flash up the PC, do the Nissan dyndns search on the mighty Google and there it is.
Try it on my phone and there it is.

When I tried it earlier I was at the airport picking up some people and was signed on to their WiFi. Not sure how or why it ended up as a different result but it did.

In any event
Please disregard message #148 about us not being there, because apparently we are.