Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pmhostname(1) [centos man page]

PMHOSTNAME(1)						      General Commands Manual						     PMHOSTNAME(1)

NAME
pmhostname - report hostname SYNOPSIS
$PCP_BINADM_DIR/pmhostname [hostname] DESCRIPTION
pmhostname reports the name of the host hostname as returned by gethostbyname(3N). If hostname is not specified, then the local host name is retrieved using gethostname(2) and this is than passed to gethostbyname(3N). pmhostname provides a service for shell scripts that mimics the logic formerly used by Performance Co-Pilot applications when trying to determine the official name of a host. PCP applications no longer use DNS-based heuristics, and therefore this command is deprecated. If gethostbyname(3N) fails, the input host name (either hostname or the result from calling gethostname(2)) is reported. PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). SEE ALSO
named(1), nsd(1), nslookup(1), gethostname(2), gethostbyname(3N), pcp.conf(5), pcp.env(5) and resolver(5). Performance Co-Pilot PCP PMHOSTNAME(1)

Check Out this Related Man Page

PMGETARCHIVELABEL(3)					     Library Functions Manual					      PMGETARCHIVELABEL(3)

NAME
pmGetArchiveLabel - fetch the label record from a performance metrics archive log C SYNOPSIS
#include <pcp/pmapi.h> int pmGetArchiveLabel(pmLogLabel *lp); cc ... -lpcp DESCRIPTION
Within the framework of the Performance Co-Pilot (PCP), archive logs of performance metrics values may be accumulated and saved using the program pmlogger(1). The routine pmGetArchiveLabel may be used to fetch the label record from an archive log that has already been opened using pmNewContext(3), or pmDupContext(3), and thereby associated with the current Performance Metrics Application Programming Interface (PMAPI) context. The result returned via the pointer lp is a structure that must be pre-allocated by the caller and has the following format (defined in pmapi.h). /* * Label Record at the start of every log file */ typedef struct { int ll_magic; /* PM_LOG_MAGIC | log format version no. */ pid_t ll_pid; /* PID of logger */ struct timeval ll_start;/* start of this log */ char ll_hostname[PM_LOG_MAXHOSTLEN]; /* name of collection host */ char ll_tz[40]; /* $TZ at collection host */ } pmLogLabel; For an application, the most useful information from the archive label is likely to be in the fields ll_start, ll_hostname or ll_tz. Note that the size of the ll_hostname field is PM_LOG_MAXHOSTLEN (64 bytes) which is less than MAXHOSTNAMELEN (see gethostbyname(3)) on some platforms. These semantics are necessary to retain backwards compatibility with the PCP archive file format. pmGetArchiveLabel returns zero for success. PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). Values for these variables may be obtained programmatically using the pmGetConfig(3) function. SEE ALSO
pmlogger(1), PMAPI(3), pmDupContext(3), pmGetConfig(3), pmNewContext(3), pcp.conf(5) and pcp.env(5). DIAGNOSTICS
PM_ERR_NOCONTEXT the current PMAPI context is either invalid, or not associated with an archive log Performance Co-Pilot PCP PMGETARCHIVELABEL(3)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

assigning a variable containing hostname

Hello.. Here is a small doubt.... I need to assign root@hostname to variable.. where hostname is the system variable... when i give variable="root@$hostname" its not working... pls help..me thanks in advance esham (4 Replies)
Discussion started by: esham
4 Replies

2. Programming

Converting a hostname argv into an IP

Ok I've been stuck on this minor point forever and I simply cannot find a way to do this. When I use something like: h = gethostbyname(argv); // argument 2 is the host or IP sin.sin_addr.s_addr = inet_addr(h->h_name); it always comes up connecting to the address 255.255.255.255 I've... (7 Replies)
Discussion started by: Codeguru
7 Replies

3. Shell Programming and Scripting

Pass hotname from command

I have a problem, which is, I have servers as $hostname : Serverxxd $hostname : Serverxxs $hostname : Serverxxl $hostname : Serverxxp d=dev, s=sit, l=stg, p=prd The packages will be in all the boxes and my script contains $ENV which I should be getting from 'hostname' I am not able to... (4 Replies)
Discussion started by: chiru_h
4 Replies

4. Shell Programming and Scripting

replace a string

hello I have a file where an entry needs to be modified. an example of this entry is: install_location=/xena/sybase/ase12_5 I need to replace xena with another hostname (`hostname` output) for example: install_location=/dx1/sybase/ase12_5 how to do that? thanks (11 Replies)
Discussion started by: melanie_pfefer
11 Replies

5. Shell Programming and Scripting

Accessing Variables from .conf file

I can't figure out how to access variables that are stored in a separate file. Can someone let me in on the secret? Please, and thank you. -Kevin (7 Replies)
Discussion started by: wayne1411
7 Replies

6. Shell Programming and Scripting

"BOLD" printing a variable in PS1 command

I would like to "BOLD" print the hostname in the following statement: export PS1=$USER"@"$(hostname -s):'$PWD>' Is there a special character I can put before and after the variable to make it bold or blinking? Thanks. (4 Replies)
Discussion started by: pdtak
4 Replies

7. UNIX for Dummies Questions & Answers

Printing hostname

Hi, I am using hostname environment variable in my shell script to print the host name but it's printing nothing.Can you please help me on this. Please find the part of the code pasted here: llist= llist=$(ps -ef | grep -v grep | grep -c "$1") echo "Hostname is ${hostname}" (7 Replies)
Discussion started by: gbiswal
7 Replies

8. IP Networking

gethostbyname_r returns NULL when hostname has dash

We have a code to find the DNS entry of a host that has a trailing '-' in its url (format example: mysite-.watch.com): if(gethostbyname_r(host,host_ent,host_buffer,host_buffer_size,&host_error)==NULL) { //failed } But when remove the '-' from the host name the code does not return... (12 Replies)
Discussion started by: uunniixx
12 Replies

9. Shell Programming and Scripting

sed command

hello - I have a hostname named this: ctolinuxpoc01.ilab.local I want to only return the first part - ctolinuxpoc01 I found this sed command, but I do not understand how it is only returning the first part: HOST_NAME=`hostname | sed -e 's/^\(*\).*/\1/g'` echo $HOST_NAME Can... (5 Replies)
Discussion started by: mlike
5 Replies

10. Shell Programming and Scripting

Print the first four characters of hostname

Hey, I'm trying to print the first four characters of the hostname of a computer. I can get it from using: hostname -s | sed 's/...........$//'" but this is when I know how many characters are in the computer name. I dont understand why some like: hostname -s | sed '/..../p' wont... (7 Replies)
Discussion started by: yxian
7 Replies

11. Shell Programming and Scripting

Bash script to read a hostname and separate into variables

Hi All, I'm trying to concoct a bash script to use with a Puppet Implementation that will accept a hostname and break it down into variables. For example, my hostnames look like this --> machinename-group-building.example.com I'm looking for a way in the script to read until the first... (4 Replies)
Discussion started by: glarizza
4 Replies

12. Shell Programming and Scripting

Array reference problem

i have a variable MYHOST that has my host name.depending on the host i have an array like A_<hostname>.Everytime i need to append the hostname to A_ to get the array.but in the shell script i am nt able to access the members of that array. code of what i hav done: export temp=A_$MYHOST for... (15 Replies)
Discussion started by: niteesh_!7
15 Replies

13. Shell Programming and Scripting

Cutting string values from a file

My file looks like this.... User:SYSTEM,O/S User:oracle,Process:3408086,Machine:hostname ,Program:sqlplus@hostname (TNS V1-V,Logon Time:25-JUL-20 14 13:36 I want to get the date and time which is displayed after the 'Logon time'. (5 Replies)
Discussion started by: Nagesh_1985
5 Replies

14. Shell Programming and Scripting

Script Shell Extracting hostname

Hi all, Please i have to get hostname of an ip address (172.16.68.4). so i have used the command 'host' host $ipaddr >> iptohostname.txt Here is my file: iptohostname.txt 4.68.16.172.in-addr.arpa domain name pointer g-4.xxx.yyyy.zz. 3.68.16.172.in-addr.arpa domain name pointer... (11 Replies)
Discussion started by: chercheur111
11 Replies

15. Shell Programming and Scripting

How to print last character of hostname and assign to a variable ?

Hi How to pass echo output to a variable ? Does below awk command will get the last character of hostname and assign to a variable - "svr" ? svr=$( echo `hostname` | awk '{print substr($0,length,1)}' ) Thanks. Please use CODE tags when dsplaying code segments, sample input, and sample... (7 Replies)
Discussion started by: Lim
7 Replies