What's the difference between:
cat /etc/passwd
and
ypcat passwd
? What is ypcat exactly?
Why do I get this:
ypcat: can't get local yp domain: Local domain name not set
when running
ypcat passwd.
ypcat shows the data from the NIS database, which may not be on your computer. That holds network accounts (which allow you to log into various computers on your network). It is named with a "yp" prefix since the original programs were referred to as "yellow pages" (until Sun and others were told to stop doing that — by the phone company).
cat (of course) shows only data from a file on your computer, which lists local accounts.
Further reading:
28.4. Network Information System (NIS) (FreeBSD handbook)
Using NIS (Introduction to Unix Systems Administration, IFSM 498B)
The cat command is used to concatenate and display the contents of the given files.
ypcat on the other hand
prints out the Network Information Services (NIS) map you specify with the MapName parameter. You can specify either a map name or a map nickname. Because the ypcat command uses the NIS service, you do not need to specify a server
where NIS is
The Network Information Service, or NIS (originally called Yellow Pages or YP) is a client–server directory service protocol for distributing system configuration data such as user and host names between computers on a computer network.
Read about ypcat here : http://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.cmds6/ypcat.htm
Read about NIS here : https://en.wikipedia.org/wiki/Network_Information_Service
Related
I need the DNS suffix of all my local interfaces on my PC.
Is there way how I can achieve this via Go?
Best case would be for any OS
Necessary: working on Windows
I have tried net.Inferfaces() and all the net commands but I haven't found anything regarding the DNS server.
EDIT
I have found the solution for the Windows-specific version but it would be interesting if there is anything that works for Linux and macOS too.
I don't think there is a solution that work for any OS. In Linux the DNS suffix is not interface specific but system wide, it is configured in /etc/resolv.conf. Here is an excerpt from the man page:
search Search list for host-name lookup.
By default, the search list contains one entry, the local domain name. It is determined from the local hostname returned by gethostname(2); the local domain name is taken to be everything after the first '.'. Finally, if the hostname does not contain a '.', the root domain is assumed as the
local domain name.
This may be changed by listing the desired domain search path following the search keyword with spaces or tabs separating the names. Resolver queries having fewer than ndots dots (default is 1) in them will be attempted using each component of the search path in turn until a match is found.
For environments with multiple subdomains please read options ndots:n below to avoid man-in-the-middle attacks and unnecessary traffic for the root-dns-servers. Note that this process may be slow and will generate a lot of network traffic if the servers for the listed domains are not local, and
that queries will time out if no server is available for one of the domains.
If there are multiple search directives, only the search list from the last instance is used.
The net package standard library parses this file to get the DNS config, so the DNS resolver should behave as expected, however, the parsing functionality is not exposed.
The libnetwork.GetSearchDomains func in the libnetwork library should be able to help you out. If there are no search entries in /etc/resolv.conf, you should use the hostname, which can be gotten with the os.Hostname func.
I believe this also works for FreeBSD and Mac OS since they are both "UNIX like". But I am not 100% sure.
I wrote a simple note taking program that's nothing more than a dictionary mapping a key to a value. IE
$ hlp -key age -value 25
$ hlp age
25
and it just stores information in a json file hardcoded to ~/.hlp.json. But I was wondering if there's likely some standard location I should be putting this file. Is there a standard location for databases like this?
A useful resource here is the hier(7) man page. (http://linux.die.net/man)
Data that is only going to be used by you belongs in $HOME, traditionally hosted under /home.
For something that is used to support the system itself, you'd be using /var. For applications that are just hosted on the system, you'd use /var/opt.
If the application is something big that could be replicated or moved to another system, you'd create a separate filesystem with a mount point outside any of those listed in hier(7). This could be a filesystem mounted from a SAN or NAS, which whould help mobility of the application.
Once you actually need to access the data from different machines, you'd have to move it to a network accessable key/value store or sql database.
When using CFPreferences to set preferences on osx, there are different
Preference Domains.
By reading the apple development guide, I understand that for current-user, current-application, current-host preference, it will be stored in ~/Library/Preferences/< application bundle name >.plist. And for any-user, current-application, current-host preference, it will be stored in /Library/Preferences/< application bundle name >.plist.
But where to store preferences for other domain combinations? For example current-user, current-application, any-host? Will the preferences be propagated during set time (CFPreferencesSetAppValue follow by synchronize) to ~/Library/Preferences/< application bundle name >.plist on all hosts that are connected to the local network and logged in as the current user? Or the magic is done during read when all hosts are consulted (but how to handle conflict preferences from different hosts in that case)?
Same question for the any-application domain, where will the preference get stored for domain such as current-user, any-application, current-host?
The "default" for preferences is current-user, current-application, any-host. Using the bundle name com.example for an example, these preferences would be stored at
~/Library/Preferences/com.example.plist
What makes this "any-host" is the assumption that your home directory is stored on a network share. There is no additional mechanism to synchronize it across computers. Generally speaking, you should always use any-host unless you are setting a value which really does need to be specific to the physical machine the user is sitting at.
Preferences which are set for the current host are stored under the ByHost directory, with a file name that includes a UUID for the computer, such as:
~/Library/Preferences/ByHost/com.example.74263C97-28D5-4AF0-8E7A-3169F1CCB545.plist
Preferences which are set for all applications are stored under the bundle name .GlobalPreferences, e.g:
~/Library/Preferences/.GlobalPreferences.plist
and similarly for all applications, current-host:
~/Library/Preferences/ByHost/.GlobalPreferences.74263C97-28D5-4AF0-8E7A-3169F1CCB545.plist
Preferences which are set for all users follow the same pattern, except under /Library/Preferences.
We have an AWS instance, where we have installed Nagios Core and we want to host multiple monitoring for different set of hosts and services. For example, when we type:
https://nagiosdev1.com/nagios_test1/ it should direct to one set of host groups, and
https://nagiosdev1.com/nagios_test2/ it should direct to another set of host groups.
Test2 is cloned from Test1, and both web-pages are working,but they do not show their independent host groups. We modified all host groups in Test2 and they are different from Test1.
At server level, we have specifically mentioned what host groups both should contain, but the GUI part for Test2 are showing the hosts of Test1.
If we make any changes on Test1, it is getting replicated on Test2. But any changes on Test2 doesn't show up.
Test1
Test2
[aghosh#nagiosdev apt]$ cd /usr/local/nagios
test1/ test2/
[aghosh#nagiosdev apt]$ pwd
/usr/local/test2/etc/apt
[aghosh#nagiosdev apt]$ ls | wc -l
1
[aghosh#nagiosdev apt]$ pwd
/usr/local/test1/etc/apt
[aghosh#nagiosdev apt]$ ls | wc -l
25
As you can see, Test2 has only 1 host group, while Test1 has 25.
The whole point being, one site will be holding production host groups and other site will be hosting non-prod host groups.
Anyone got ideas?
Your description of the problem I.e what steps you have performed and what you are looking to achieve completely mismatches moreover this is not following any Nagios best practice methodology. Owing to very little information on reasons why you are creating two different host group in the same server for two different set of to be monitored host ( Prod and Non Prod) and trying to call them by different URI isn't clear to me. In my several Nagios over AWS and GCP I haven't ever used such a crude method. Nagios XI has sophisticated method of host separation and a multi site Nagios Architecture would require you to consider lot more than just creating two hostgroup. For two different set of hosts in same network you may register them on same server with host agents reporting to master, if host are in different network you would use two different Nagios server i.e two different EC2 instance holding two different URL.
Regarding why the nagios_test1 is resembling nagios_test2 in your case, I suspect you are incorrectly calling the host groups which is why every time it is returning you same set of data. You should know NagiosXi provide Nagios API which can be used to show hostgroup members and service group members. Vanilla Nagios free version doesn't provide the same. This could be reason, it can also happen when incorrectly copied the template data for host and services. They may pass Nagios syntax check but provide wrong host / service information.
Supporting Nagios Doc: https://assets.nagios.com/downloads/nagiosxi/docs/Accessing_The_XI_Backend_API.pdf
Hope you have got your answer.
Try not to create two different directories like test1 & test2. Rather, prefer you to create the soft link on test1 to test2 so that physically it appears two different sites but logically it points to the directory test1.
ln -s nagios_test1 nagios_test2
https://nagiosdev1.com/nagios_test1/
https://nagiosdev1.com/nagios_test2/
I just opened Terminal and I see this m:~ luka$ and not the default that I usually get of "lukasMacBookProEtcEtc:~ luka$
Anyone know why this is? Does this make an impact on what I write into the command line?
Can't find anything on the elsewhere.
This means your computer's host name has changed. This is typical if you switch to a different network, unless you have a statically assigned name or IP address. By default, your computer asks the current network what name to use for itself.
Whether this particular host name is correct or incorrect requires more context. If network operations are working fine for you, then there probably isn't an issue.
No, in general the hostname doesn't directly affect what you write into the command line unless you're writing commands that depend on the current hostname or this unexpected hostname is a symptom of a networking issue and you try entering a command that depends on networking.
Note that on OS X a given computer has at least two different names. One is the “computer name”, typically assigned by the user, and the other is the “host name”, typically assigned to your computer by a server on the local network. The former is the “Computer Name:” at the top of System Preferences > Sharing, and users can usually feel free to name their computers as they wish unless otherwise directed by a system administrator. The host name is visible as the output of the hostname command and is typically displayed in the shell command prompt. You should normally not attempt to change the host name unless directed to by a system administrator.