w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Perl called from Nagios: localtime returns time when nagios daemon was last started
The problem was, as you addressed in a comment, that you were passing $^T (which holds the time the program was started) to localtime(). As you noted, you can say localtime(time) - or even easier, just pass nothing to localtime - perldoc -f localtime explains: If EXPR is omitted, "localtime()" uses the current time (as returned by time(3)). So, just say localtime(), and your problems go away :)

Categories : Perl

Create java application to show nagios status monitoring
If you are asking how your Java application can read the current Nagios service statuses, then I would suggest you use the Nagios livestatus module, and have your Java application query that. Livestatus allows your application, whatever it is written in, to query the running Nagios process and pull out the current and historical data, plus the configuration information.

Categories : Java

Uploaded images don't immediately show on localhost
I suddenly had images not displaying in FireFox only for localhost sites. Took me ages to find the problem... Goto: Tools > Page Info Select "Media" tab, make sure the checkbox "block images from localhost" is unchecked. You'll need to be viewing the a localhost file when you view this dialog box to apply the change to localhost images.

Categories : Firefox

convert a nagios config file to csv
This awk should work : awk 'BEGIN{print "host_name,hostgroups,check_interval"}/host_name/{v1=$2} /hostgroups/{v2=$2} /check_interval/{v3=$2} /}/{print v1","v2","v3; v1=v2=v3=""}' file

Categories : Bash

Not able to configure remote nrpe plugins for nagios
Sometimes this might also mean that the server is trying to perform a check with SSL while the NRPE daemon is not running with the SSL option (or the other way around). Could you try running the check like below ? /usr/local/nagios/libexec/check_nrpe -H localhost -n

Categories : Linux

Do I need to create an account for Nagios user in Linux?
Probably no problems there, it's common to disable login for daemon "users". Check /etc/passwd, the login shell is probably disabled for this user. You shouldn't be executing commands as nagios.

Categories : Linux

Nagios plugin script not working as expected
Personally I think it may be due to the definition of jvmtop.sh on line 120, my suggestion would be to give the full path to the script.... tmp_output=$(./jvmtop.sh --once | grep $process) to tmp_output=$(/path/to/jvmtop.sh --once | grep $process) If this does not help, try enabling debug and defining the debug level in your nagios.cfg: debug_level=2048 debug_file=/var/log/nagios_debug.log Do turn this off once you have finished with it. E2A: One last thing would be after this line (120) to echo out the result of tmp output to a temp file and look at its output to see if it has really worked ! so echo $tmp_output > /tmp/observe.txt since my my suspicion still is on this - I sent a comment above to also export out your java home since its either that it can't find this jvmtop.

Categories : Bash

how can execute nagios commands from command line in linux
You actually have the answer in your config - just execute in shell: /usr/lib/nagios/plugins/check_http -H site1.dreaddomain.com You may add -v for verbose output. Nagios is only a scheduler and executes commands at specified intervals. Then reports the state based on response.

Categories : Linux

Making check_http (Nagios) check for a certain number of strings
You can achieve this via a cunningly constructed regexp. However, you then get the problem that you have to negate the response as check_http doesn't provide a 'not regexp' option (I feel it should, but it doesn't). So, if you want to alert on >3 instances of 'error', use something like this: negate "check_http www.myserver.co.nz -r '(error.*){4}'" You might want to do a separate check to identify slow responses, though, and the returned information string might be a bit misleading. If you can check the file directly (or via NRPE) then you could write a script to use egrep with a similar regexp.

Categories : String

How to use nginx as reverse proxy to direct localhost:9292 to a sub domain foo.localhost/?
If foo.localhost is your sub domain name and you want to proxy pass sub-domain to main-domain, you can use proxy_pass and you can learn a little more about server directive if needed. An example: server { listem 8080; host sub.main.com; ... location / { proxy_pass http://main.com; break; } } server { listen 8081; host main.com; ... location / { //do something } } This is proxy pass, means when access sub.main.com, actually it finally dealt by main.com, but the client side still shows sub.main.com. If you want client side shows main.com, here should use redirect but not proxy_pass.

Categories : Nginx

ajax call not working when trying to send data to localhost:8000 from localhost
Because the port is not the same, it's considered a cross origin request. You must set a Access-Control-Allow-Origin header in the script you are requesting. Learn more: http://enable-cors.org/server.html or, specifically for django: http://chase-seibert.github.io/blog/2012/01/27/using-access-control-allow-origin-to-make-cross-domain-post-requests-from-javsacript.html

Categories : PHP

Amazon AWS server with database on localhost, how do I ssh so that my php webservices on localhost can run on it?
It sounds like you are trying to connect to your remote database from your local server (if I understand correctly). You want to double check your security groups in AWS that they are allowing your computers ip address to connect to the server instance / that port 3306 is open to your pc. If that is all set, then you should be able to connect to the instance using the public dns or elastic ip if it is an EC2 instance, or the endpoint if it is an RDS instance.

Categories : PHP

Replacing Nagios HTTP with custom (select/poll driven) daemon?
As to whether or not to let Nagios handle the scheduling and checks, I'll leave that to you as it varies depending on your version of Nagios (newer versions can run these checks concurrently), and why you want a separate daemon for it. egarding versioning of Nagios, version 3 IIRC uses concurrent checks, and scales thusly to larger node counts than you report. However, I can answer the Redis route concept as I've done it with Postfix queue stats and TTFB tracking for web sites. Setting up the check using Python with the curl and multiprocessing modules is fairly straightforward as is dumping it into Redis. An expiration of I'd say no more than the interval would be a solid idea to keep the DB from growing. I'd recommend tis value be no more (or possibly just less than) the check interval

Categories : Http

Not cross-domain. XMLHttpRequest cannot load localhost:portNo1 . Origin localhost:portNo2 is not allowed by Access-Control-Allow-Origin
Well, that's the problem. Cross-origin restrictions do not allow you to communicate across ports without sending a Access-Control-Allow-Origin: * header. A better solution would be to use Nginx or some other webserver to reverse proxy those two running applications to the same domain and port.

Categories : Javascript

Rendering PDF in browser - the PDF is showing up when running under "localhost", but NOT showing up when replacing "localhost" with my machine name
Good afternoon, try adding the following to your PdfGenerator function: HttpContext.Response.AddHeader("X-Frame-Options", "SAMEORIGIN"); Are you rendering the PDF in an IFRAME?

Categories : C#

nagios - nrpe - check_http - works from command prompt but fails on nrpe
Looks like your NRPE is not reloading due to a syntax error in the configuration file. You do not say whether you are running NRPE as a standalone daemon or via (x)inetd; also you have not shown the content of your file here, so it is hard to debug. My guess would be that you have edited the nrpe.cfg file a Windows-like editor that has added a trailing ^M to line 246, which is causing the error. Or, there is an invalid character in the line which is causing the problem. If these are not the causes, you need to post the relevant block of lines for us to examine.

Categories : Http

Nagios check_ssl_cert error: SSL_CERT CRITICAL: Error: verify depth is 6
I cannot say for certain, as I do not have all the necessary details, but it would seem that your certificate is fine, it is just that it's authentication chain is too long for check_ssl_cert to verify it. The error message says "Verify depth is 6". This means that the certificate verify chain is >6 items long, not that it is necessarily failing. Around line 228 and 205 in check_ssl_cert, you see the code: exec_with_timeout $TIMEOUT "echo 'Q' | $OPENSSL s_client ${CLIENT} ${CLIENTPASS} -connect $HOST:$PORT ${SERVERNAME} -verify 6 ${ROOT_CA} 2> ${ERROR} 1> ${CERT}" Note the -verify 6 in there limiting the maximum chain length to test. If you change this to -verify 16 (which might be overkill but should handle your chain) it will most likely work.

Categories : Ssl

Referencing Js script in one localhost site, from another localhost site
This is probably due to the same origin policy not letting ajax calls go to localhost. This might be fixed by changing the below setting before making the call. jQuery.support.cors = true You might be able to get around this by changing localhost to your computer's ip.

Categories : Javascript

https://localhost:8080 is not working but http://localhost:8080 is working well
SSL has to be on a different port. Here is the breakdown: http:// watched on port, typically 80 https:// watched on a different port, typically 443 You need to RUN SSL on a different port. Listen 8081 SSL VirtualHost <VirtualHost *:8081> # SSL Cert info here .... </VirtualHost> > service httpd restart

Categories : Http

301 Redirect for localhost/*/path to localhost/*/path/
You need to get rid of the rewrite base. It's a file-path and not a URL-path so you'll end up getting redirected to http://example.com/var/www/path1. For the trailing slash, you want: RewriteEngine On RewriteRule ^path1$ /path1/ [R=301,L] For the rest: RewriteRule ^category1/subcat1/path1$ /category1/subcat1/stuff1 [R=301,L] RewriteRule ^category2/subcat2/path2$ /category2/subcat2/stuff2 [R=301,L] etc. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+[^/])$ /$1/ [L,R=301]

Categories : Regex

Why MBProgressHUD not show, when an alert show before HUD show?
Click here! This works for me .Just use this window. UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window]; Or you can use self.navigationController.view to add you HUD.

Categories : Iphone

How to see if a Flask app is being run on localhost?
You'll want to look at the configuration handling section of the docs, most specifically, the part on dev / production. To summarize here, what you want to do is: Load a base configuration which you keep in source control with sensible defaults for things which need to have some value. Anything which needs a value should have the value set to what makes sense for production not for development. Load an additional configuration from a path discovered via an environment variable that provides environment-specific settings (e. g. the database URL). An example in code: from __future__ import absolute_imports from flask import Flask import .config # This is our default configuration app = Flask(__name__) # First, set the default configuration app.config.from_object(config) # Then, lo

Categories : Python

ModRewrite on Localhost
Make sure ModRewrite active. Put on Mod Rewrite logging. Check Apache Error and Access log to see that you connected. Also you asking to redirect php request to static htm pages. But normally people do opposite. Look here: .htaccess: rewrite .htm urls internally to .php, but also redirect .php urls to .htm

Categories : PHP

Localhost vs ip-address (e.g. 192.xxx.x.xxx)
"On most computer systems, localhost resolves to the address 127.0.0.1, which is the most-commonly used IPv4 loopback address..." (https://en.wikipedia.org/wiki/Localhost) It's likely that the "localhost" host name is being resolved to the loopback interface IP address (127.0.0.1), as that is the standard on most machines. If you want the server to respond to another IP address, you'll have to configure it.

Categories : Apache

Why LESS css does not work on localhost
It seems that your source location of your file is not correct. <script src="_/script/less-1.4.1.min.js" type="text/javascript"></script> I have never seen that "_" could be used for navigation. Actually, if the script folder is in the same directory as the html page, then <script src="script/less-1.4.1.min.js" type="text/javascript"></script> should be enough to have a working js file on your page.

Categories : HTML

Can't connect to localhost
You need to drop the single quotes around your constants: $dbc = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) OR die ('Could not connect to mysql: ' . mysqli_connect_error()); You should also refrain from using @ in front of functions. If you wish to suppress errors, use proper error handling.

Categories : PHP

How does localhost get its ID number in asp.net?
It's a Port Number. When ASP.NET development server is used to host a page or application (i.e. when your run the application directly from you Visual Studio). This Post Number is assigned randomly. You can also specify a port number to be consistent: http://msdn.microsoft.com/en-us/library/ms178109%28VS.80%29.aspx Also, you will notice that you don't see these port number when you host your application using IIS because by default port 80 is assigned to IIS.

Categories : C#

Testing UDP on localhost
If you are going to use this in a LAN setup, then you can always filter the received packet based on the sender's address -- recvmsg() of UDP allows you to retrieve sender's address and port number. If you are going to use this in a WAN setup, then this likely would not be an issue unless you are trying to do multicast. And, even with multicast, duplciate packets are not send back to the receiver. You can use IP_MULTICAST_LOOP to disable this option.

Categories : C#

OpenCover in localhost with C# MVC 4 app
The docs that are installed alongside OpenCover carry a lot of useful information about running OpenCover. You should have a copy of this file https://github.com/sawilde/opencover/blob/master/main/OpenCover.Documentation/Usage.pdf in you download package (MSI/ZIP/NUGET) The DLLs do not need to all be in the same directory but you will normally find that this happens due to the build process. Any assemblies that you want to gather coverage from will require that the PDBs for those assemblies to be in the same directory as the assembly or in the folder referenced by targetdir switch. Yes you can use it to run iisexpress or the ASP.NET development server use the target switch.

Categories : Asp Net

memcached.new with the localhost
Yes, 11211 refers to the port on which memcached accepts connections. It is not however specific to the instance of your app; any app that you run could theoretically connect to memcached on that same port, provided they have the proper credentials.

Categories : Ruby On Rails

Questions about IIS and localhost
How do I test the web application on localhost without opening VS2012? You should install (if none) IIS on your local machine, create a web application and deploy your built application there. Is it possible to access the site using http://:23456/home.aspx if testing through VS? Open web project settings, on tab 'Web' you should select "Use Custom Web server" option. is it possible to access the site using http://:23456/home.aspx when I'm using the same computer and same IP address or does this only work when accessing externally? Configure your router to redirect request on specific port to your machine with IIS installed. If 3. is not possible, would it work through TOR for instance where I'd be routing from another IP address? It should work if point 3 works.

Categories : Windows

openerp not loading on localhost
Verify that the OpenERP service is running on your computer. You can verify this by clicking on the Taskbar -> task manager -> Services. Look for the OpenERP service and start it if it is not running. A problem might have made it fail to start. There might be errors with your custom module. I tell you developing custom modules on Window is more tedious than on Linux because you can run the server in terminal mode and view output logged directly on the console

Categories : Python

Unpredictable localhost connection
According this bug report you are problably facing a known bug in chrome. Here is how to workaround it: set "Built-in Asynchronous DNS" flag (in chrome://flags) to Disabled and restart

Categories : Google Chrome

mod_rewrite of localhost subfolder
add the following directive to .htaccess in your subdirectory /test RewriteEngine on RewriteBase /test/ RewriteCond !index.php RewriteRule ^(.+)$ index.php?url=$1 [L,QSA,NC]

Categories : PHP

GA Event Tracking from localhost
Try put this line before the first pageview: _gaq.push(['_setDomainName', 'none']); Your tracker will be similar this: <script> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-12345-1']); _gaq.push(['_setDomainName', 'none']); _gaq.push(['_trackPageview']); </script> This option works directly with the cookie configuration, so use only for locahost!

Categories : Javascript

How to change a localhost url to ip in wordpress?
You put your IP address allocated by the network's DHCP server(if it exists) instead of 'localhost' it should work. else just put your ip address form the other computers connected to the network. Eg. If your IP address turns out to be 127.23.45.66 You should enter this in the address bar of the other comps 127.23.45.66/wordpress/sitename

Categories : Wordpress

Security of localhost connection
As you have guessed, it is kind of pointless to use SSL for local connections. SSL's main purpose is to encrypt the channel so as to prevent man-in-the-middle-like attacks. But there can be no man in the middle in case of local connection. In you setup, I would recommend a connection through a local socket, and bypass the TCP layer altogether. Now back to the question. Should I be encrypting in PHP before storing the data? No, if the database is on the same machine as the one that executes the script. No, if the database is remote, and if the link is trusted (either you trust the link per se, or the link is secured eg. with SSL). Yes, in all other situations. In the latter case (untrusted link to a remote database), AES_ENCRYPT() is not suitable. The encryption/decryption process

Categories : PHP

From live site to localhost
Change your rewrite rule to RewriteEngine On RewriteBase /httpdocs/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(([^/]+/)*[^/]+)/?$ index.php?path=$1 [L,QSA] EDIT : (How this regex works?) This matches all the nested directories: [^/]+/ = [^/] Anything but not /; + One or more times; / followed by a slash ([^/]+/)* = (..)* Match what's inside () repeatedly, * zero or more times This matches the last URL directory: <nested-dir-regex>[^/]+ = Anything but not /; one or more times + (<nested-dir-regex>[^/]+) = With () around it can be captured as $1 now (<nested-dir-regex>[^/]+)/? = Optionally, followed by last /; matches ? zero or one ^(<nested-dir-regex>[^/]+)/?$ = ^ denotes start of path string; $ denotes end of pa

Categories : Apache

cURL connecting to the localhost when given a bad URL
Thanks to Brad for pointing me in the right direction to find this: Our test server had both a wildcard *.nitrc.org defined in DNS and also a "search nitrc.org" directive in resolve.conf. Therefore, every domain that wasn't valid would be prepended to nitrc.org and would then match our wildcard dns.

Categories : PHP

PHP 5.5 setcookie localhost not working
Try this, sets cookie $time=time(); setcookie("test", "value", time()+86400); The time can be adjusted it's set for one day before it expires. To read the cookie $varname = $_COOKIE["test"]; echo $varname; It should echo out value since that is the example data your setting in cookie. You can also use the same name for setcookie to override your existing value

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.